diff options
-rw-r--r-- | archival/unzip.c | 2 | ||||
-rw-r--r-- | include/libbb.h | 1 | ||||
-rw-r--r-- | libbb/make_directory.c | 7 |
3 files changed, 8 insertions, 2 deletions
diff --git a/archival/unzip.c b/archival/unzip.c index 3c76cdafc..c1b945a44 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
@@ -596,7 +596,7 @@ int unzip_main(int argc, char **argv) | |||
596 | printf(" creating: %s\n", dst_fn); | 596 | printf(" creating: %s\n", dst_fn); |
597 | } | 597 | } |
598 | unzip_create_leading_dirs(dst_fn); | 598 | unzip_create_leading_dirs(dst_fn); |
599 | if (bb_make_directory(dst_fn, dir_mode, 0)) { | 599 | if (bb_make_directory(dst_fn, dir_mode, FILEUTILS_IGNORE_CHMOD_ERR)) { |
600 | xfunc_die(); | 600 | xfunc_die(); |
601 | } | 601 | } |
602 | } else { | 602 | } else { |
diff --git a/include/libbb.h b/include/libbb.h index f12800f53..5e5c8c7e8 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -333,6 +333,7 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ | |||
333 | FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 9, /* -c */ | 333 | FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 9, /* -c */ |
334 | FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10, | 334 | FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10, |
335 | #endif | 335 | #endif |
336 | FILEUTILS_IGNORE_CHMOD_ERR = 1 << 11, | ||
336 | }; | 337 | }; |
337 | #define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c") | 338 | #define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c") |
338 | extern int remove_file(const char *path, int flags) FAST_FUNC; | 339 | extern int remove_file(const char *path, int flags) FAST_FUNC; |
diff --git a/libbb/make_directory.c b/libbb/make_directory.c index 72303e7a3..7826b90f5 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c | |||
@@ -107,6 +107,10 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) | |||
107 | * an error. */ | 107 | * an error. */ |
108 | if ((mode != -1) && (chmod(path, mode) < 0)) { | 108 | if ((mode != -1) && (chmod(path, mode) < 0)) { |
109 | fail_msg = "set permissions of"; | 109 | fail_msg = "set permissions of"; |
110 | if (flags & FILEUTILS_IGNORE_CHMOD_ERR) { | ||
111 | flags = 0; | ||
112 | goto print_err; | ||
113 | } | ||
110 | break; | 114 | break; |
111 | } | 115 | } |
112 | goto ret0; | 116 | goto ret0; |
@@ -116,8 +120,9 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) | |||
116 | *s = c; | 120 | *s = c; |
117 | } /* while (1) */ | 121 | } /* while (1) */ |
118 | 122 | ||
119 | bb_perror_msg("can't %s directory '%s'", fail_msg, path); | ||
120 | flags = -1; | 123 | flags = -1; |
124 | print_err: | ||
125 | bb_perror_msg("can't %s directory '%s'", fail_msg, path); | ||
121 | goto ret; | 126 | goto ret; |
122 | ret0: | 127 | ret0: |
123 | flags = 0; | 128 | flags = 0; |