diff options
author | Natanael Copa <natanael.copa@gmail.com> | 2012-05-22 17:11:46 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-05-28 01:29:15 +0200 |
commit | 02112d8ae3d0c07214fb2b132e0eacb4ff39d167 (patch) | |
tree | 8cc41e1af5cdea68c393190b27f902f3a0a195fd | |
parent | dfc2473b9ed88039697ac89ee2a4301cdaefcf84 (diff) | |
download | busybox-02112d8ae3d0c07214fb2b132e0eacb4ff39d167.tar.gz |
unzip: ignore chmod errors
This makes unzip to FAT filesystems not exit with error.
This is similar to how the "normal" unzip works.
Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-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) printf(" creating: %s\n", dst_fn); } unzip_create_leading_dirs(dst_fn); - if (bb_make_directory(dst_fn, dir_mode, 0)) { + if (bb_make_directory(dst_fn, dir_mode, FILEUTILS_IGNORE_CHMOD_ERR)) { xfunc_die(); } } 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. */ FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 9, /* -c */ FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10, #endif + FILEUTILS_IGNORE_CHMOD_ERR = 1 << 11, }; #define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c") 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) * 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; + } break; } goto ret0; @@ -116,8 +120,9 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags) *s = c; } /* while (1) */ - bb_perror_msg("can't %s directory '%s'", fail_msg, path); flags = -1; + print_err: + bb_perror_msg("can't %s directory '%s'", fail_msg, path); goto ret; ret0: flags = 0; |