aboutsummaryrefslogtreecommitdiff
path: root/libbb/make_directory.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-01-04 11:32:33 +0000
committerRon Yorston <rmy@pobox.com>2017-01-04 11:41:38 +0000
commitf9cf712f8a640ac2d250dfa77dd809ab033f618a (patch)
treec8f6135b5842e0110ca54d6690ab95b28792bb1e /libbb/make_directory.c
parent71ecc8033e6989996057b32577e71148fd544596 (diff)
parentc6725b0af68238a456690146adec763c04f66c82 (diff)
downloadbusybox-w32-f9cf712f8a640ac2d250dfa77dd809ab033f618a.tar.gz
busybox-w32-f9cf712f8a640ac2d250dfa77dd809ab033f618a.tar.bz2
busybox-w32-f9cf712f8a640ac2d250dfa77dd809ab033f618a.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/make_directory.c')
-rw-r--r--libbb/make_directory.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index 3980376ec..840c525b0 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)
35 char c; 35 char c;
36 struct stat st; 36 struct stat st;
37 37
38 /* Happens on bb_make_directory(dirname("no_slashes"),...) */ 38 /* "path" can be a result of dirname().
39 if (LONE_CHAR(path, '.')) 39 * dirname("no_slashes") returns ".", possibly read-only.
40 * musl dirname() can return read-only "/" too.
41 * We need writable string. And for "/", "." (and ".."?)
42 * nothing needs to be created anyway.
43 */
44 if (LONE_CHAR(path, '/'))
40 return 0; 45 return 0;
46 if (path[0] == '.') {
47 if (path[1] == '\0')
48 return 0; /* "." */
49// if (path[1] == '.' && path[2] == '\0')
50// return 0; /* ".." */
51 }
41 52
42 org_mask = cur_mask = (mode_t)-1L; 53 org_mask = cur_mask = (mode_t)-1L;
43 s = path; 54 s = path;