--- libutil/mkdirp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libutil/mkdirp.c b/libutil/mkdirp.c index 7796e24..2ef94a3 100644 --- a/libutil/mkdirp.c +++ b/libutil/mkdirp.c _AT_@ -10,6 +10,15 @@ int mkdirp(const char *path) { char tmp[PATH_MAX], *p; + struct stat st; + + if (stat(path, &st) == 0) { + if (S_ISDIR(st.st_mode)) + return 0; + errno = ENOTDIR; + weprintf("%s:", path); + return -1; + } estrlcpy(tmp, path, sizeof(tmp)); for (p = tmp + (tmp[0] == '/'); *p; p++) { -- 2.11.0Received on Thu Dec 15 2016 - 04:40:05 CET
This archive was generated by hypermail 2.3.0 : Thu Dec 15 2016 - 04:48:30 CET