+ if (errno == EEXIST) { /* Something exists here, might not be a dir. */
+ r = lstat (path, &buf);
+ if (r == -1) return -1;
+ if (!S_ISDIR (buf.st_mode)) {
+ errno = ENOTDIR;
+ return -1;
+ }
+ return 0; /* OK - directory exists here already. */
+ }
+