commit - 21908da4c3cfc3f2d04dd511bd59c1c877f92b14
commit + c65fcef2fb5ed060705587a71de3fc3eff245082
blob - 62fe285a54aaefa790d4d2c759df4e4733ec5fd0
blob + b0d9794ebfc49ab71d20e5bfc73ea9811d5d1bf0
--- lib/worktree.c
+++ lib/worktree.c
err = make_parent_dirs(parent);
if (err)
return err;
+ if (mkdir(parent, GOT_DEFAULT_DIR_MODE) == -1)
+ return got_error_from_errno();
} else
- return got_error_from_errno();
+ err = got_error_from_errno();
}
- return NULL;
+ return err;
}
static const struct got_error *
if (!S_ISDIR(sb.st_mode)) {
/* TODO directory is obstructed; do something */
- return got_error(GOT_ERR_FILE_OBSTRUCTED);
+ err = got_error(GOT_ERR_FILE_OBSTRUCTED);
+ goto done;
}
return NULL;
- }
-
- if (errno == ENOENT) {
+ } else if (errno == ENOENT) {
err = make_parent_dirs(abspath);
if (err)
- return err;
- if (mkdir(abspath, GOT_DEFAULT_DIR_MODE) == 0)
- return NULL;
- } else {
+ goto done;
+ if (mkdir(abspath, GOT_DEFAULT_DIR_MODE) == -1)
+ err = got_error_from_errno();
+ } else
err = got_error_from_errno();
- goto done;
- }
}
done: