diff options
author | Denys Vlasenko | 2010-06-18 02:00:55 +0200 |
---|---|---|
committer | Denys Vlasenko | 2010-06-18 02:00:55 +0200 |
commit | d86b4c3907a78ab8785bcd6342ca233d0fe23ed0 (patch) | |
tree | 82c99ea6266a0587236e7b17f39dc541ebbe1936 /archival/libunarchive | |
parent | 0cc25945d8e6821d967bb97266774f9ee6c07197 (diff) | |
download | busybox-d86b4c3907a78ab8785bcd6342ca233d0fe23ed0.zip busybox-d86b4c3907a78ab8785bcd6342ca233d0fe23ed0.tar.gz |
data_extract_all: do not chmod symlink. Closes 2053
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libunarchive')
-rw-r--r-- | archival/libunarchive/data_extract_all.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c index 8152610..c4ffe7e 100644 --- a/archival/libunarchive/data_extract_all.c +++ b/archival/libunarchive/data_extract_all.c @@ -152,35 +152,32 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle) bb_error_msg_and_die("unrecognized file type"); } - if (!(archive_handle->ah_flags & ARCHIVE_DONT_RESTORE_OWNER)) { -#if ENABLE_FEATURE_TAR_UNAME_GNAME - if (!(archive_handle->ah_flags & ARCHIVE_NUMERIC_OWNER)) { + if (!S_ISLNK(file_header->mode)) { + if (!(archive_handle->ah_flags & ARCHIVE_DONT_RESTORE_OWNER)) { uid_t uid = file_header->uid; gid_t gid = file_header->gid; - - if (file_header->tar__uname) { +#if ENABLE_FEATURE_TAR_UNAME_GNAME + if (!(archive_handle->ah_flags & ARCHIVE_NUMERIC_OWNER)) { + if (file_header->tar__uname) { //TODO: cache last name/id pair? - struct passwd *pwd = getpwnam(file_header->tar__uname); - if (pwd) uid = pwd->pw_uid; - } - if (file_header->tar__gname) { - struct group *grp = getgrnam(file_header->tar__gname); - if (grp) gid = grp->gr_gid; + struct passwd *pwd = getpwnam(file_header->tar__uname); + if (pwd) uid = pwd->pw_uid; + } + if (file_header->tar__gname) { + struct group *grp = getgrnam(file_header->tar__gname); + if (grp) gid = grp->gr_gid; + } } +#endif /* GNU tar 1.15.1 uses chown, not lchown */ chown(file_header->name, uid, gid); - } else -#endif - chown(file_header->name, file_header->uid, file_header->gid); - } - if (!S_ISLNK(file_header->mode)) { + } /* uclibc has no lchmod, glibc is even stranger - * it has lchmod which seems to do nothing! * so we use chmod... */ if (!(archive_handle->ah_flags & ARCHIVE_DONT_RESTORE_PERM)) { chmod(file_header->name, file_header->mode); } - /* same for utime */ if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) { struct timeval t[2]; |