diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/make_directory.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c index b9916d165..64736efbe 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c | |||
@@ -92,6 +92,7 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) | |||
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | //bb_error_msg("mkdir '%s'", path); | ||
95 | if (mkdir(path, 0777) < 0) { | 96 | if (mkdir(path, 0777) < 0) { |
96 | /* If we failed for any other reason than the directory | 97 | /* If we failed for any other reason than the directory |
97 | * already exists, output a diagnostic and return -1 */ | 98 | * already exists, output a diagnostic and return -1 */ |
@@ -118,13 +119,16 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) | |||
118 | /* Done. If necessary, update perms on the newly | 119 | /* Done. If necessary, update perms on the newly |
119 | * created directory. Failure to update here _is_ | 120 | * created directory. Failure to update here _is_ |
120 | * an error. */ | 121 | * an error. */ |
121 | if ((mode != -1) && (chmod(path, mode) < 0)) { | 122 | if (mode != -1) { |
122 | fail_msg = "set permissions of"; | 123 | //bb_error_msg("chmod 0%03lo mkdir '%s'", mode, path); |
123 | if (flags & FILEUTILS_IGNORE_CHMOD_ERR) { | 124 | if (chmod(path, mode) < 0)) { |
124 | flags = 0; | 125 | fail_msg = "set permissions of"; |
125 | goto print_err; | 126 | if (flags & FILEUTILS_IGNORE_CHMOD_ERR) { |
127 | flags = 0; | ||
128 | goto print_err; | ||
129 | } | ||
130 | break; | ||
126 | } | 131 | } |
127 | break; | ||
128 | } | 132 | } |
129 | goto ret0; | 133 | goto ret0; |
130 | } | 134 | } |