summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko2018-02-06 17:59:32 +0100
committerDenys Vlasenko2018-02-06 17:59:32 +0100
commit5cdd120f0c6423a42fa2eec2311126142a9a49f0 (patch)
treeca688521c96d2cc58d4bf72ce486023741a8106e /libbb
parent0a90960f446ebaf062244afbc626546b14689e0a (diff)
downloadbusybox-5cdd120f0c6423a42fa2eec2311126142a9a49f0.zip
busybox-5cdd120f0c6423a42fa2eec2311126142a9a49f0.tar.gz
unzip: do not set directory mode to 0777
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882177 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/make_directory.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index b9916d1..64736ef 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)
}
}
+ //bb_error_msg("mkdir '%s'", path);
if (mkdir(path, 0777) < 0) {
/* If we failed for any other reason than the directory
* already exists, output a diagnostic and return -1 */
@@ -118,13 +119,16 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags)
/* Done. If necessary, update perms on the newly
* created directory. Failure to update here _is_
* an error. */
- if ((mode != -1) && (chmod(path, mode) < 0)) {
- fail_msg = "set permissions of";
- if (flags & FILEUTILS_IGNORE_CHMOD_ERR) {
- flags = 0;
- goto print_err;
+ if (mode != -1) {
+ //bb_error_msg("chmod 0%03lo mkdir '%s'", mode, path);
+ if (chmod(path, mode) < 0)) {
+ fail_msg = "set permissions of";
+ if (flags & FILEUTILS_IGNORE_CHMOD_ERR) {
+ flags = 0;
+ goto print_err;
+ }
+ break;
}
- break;
}
goto ret0;
}