aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-01-26 12:19:08 +0200
committerLasse Collin <lasse.collin@tukaani.org>2011-01-26 12:19:08 +0200
commit03ebd1bbb314f9f204940219a835c883bf442475 (patch)
tree1a7284d82694aff02f080285756091d3e0cea656
parentUpdated THANKS. (diff)
downloadxz-03ebd1bbb314f9f204940219a835c883bf442475.tar.xz
xz: Fix --force on setuid/setgid/sticky and multi-hardlink files.
xz didn't compress setuid/setgid/sticky files and files with multiple hard links even with --force. This bug was introduced in 23ac2c44c3ac76994825adb7f9a8f719f78b5ee4. Thanks to Charles Wilson.
-rw-r--r--src/xz/file_io.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/xz/file_io.c b/src/xz/file_io.c
index 6e24c58a..09edcca6 100644
--- a/src/xz/file_io.c
+++ b/src/xz/file_io.c
@@ -457,15 +457,14 @@ io_open_src_real(file_pair *pair)
goto error;
}
- if (reg_files_only) {
- if (!S_ISREG(pair->src_st.st_mode)) {
- message_warning(_("%s: Not a regular file, "
- "skipping"), pair->src_name);
- goto error;
- }
+ if (reg_files_only && !S_ISREG(pair->src_st.st_mode)) {
+ message_warning(_("%s: Not a regular file, skipping"),
+ pair->src_name);
+ goto error;
+ }
- // These are meaningless on Windows.
#ifndef TUKLIB_DOSLIKE
+ if (reg_files_only && !opt_force) {
if (pair->src_st.st_mode & (S_ISUID | S_ISGID)) {
// gzip rejects setuid and setgid files even
// when --force was used. bzip2 doesn't check
@@ -495,8 +494,8 @@ io_open_src_real(file_pair *pair)
"skipping"), pair->src_name);
goto error;
}
-#endif
}
+#endif
return false;