That would look something like

```rust
match mkdir(&curpath, mode) {
    Err(mkdir_err) => {
        let sb = try!(stat(&curpath));
        if sb.kind != TypeDirectory {
            return Err(mkdir_err);
        }
        // else the directory exists, which is fine by us
    }
    Ok(_) => ()
}
```

This also explicitly uses `stat()` so we know it reads through symlinks. I don't know whether `.is_dir()` does.