1303 files changed, 32187 insertions, 57138 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c index 7826b90..a6b7c28 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c @@ -35,9 +35,20 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) char c; struct stat st; - /* Happens on bb_make_directory(dirname("no_slashes"),...) */ - if (LONE_CHAR(path, '.')) + /* "path" can be a result of dirname(). + * dirname("no_slashes") returns ".", possibly read-only. + * musl dirname() can return read-only "/" too. + * We need writable string. And for "/", "." (and ".."?) + * nothing needs to be created anyway. + */ + if (LONE_CHAR(path, '/')) return 0; + if (path[0] == '.') { + if (path[1] == '\0') + return 0; /* "." */ +// if (path[1] == '.' && path[2] == '\0') +// return 0; /* ".." */ + } org_mask = cur_mask = (mode_t)-1L; s = path; @@ -99,6 +110,10 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) if (!c) { goto ret0; } + } else { + if (flags & FILEUTILS_VERBOSE) { + printf("created directory: '%s'\n", path); + } } if (!c) { |