mirror of https://git.tukaani.org/xz.git
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 23ac2c44c3
.
Thanks to Charles Wilson.
This commit is contained in:
parent
7bd0a5e7cc
commit
03ebd1bbb3
|
@ -457,15 +457,14 @@ io_open_src_real(file_pair *pair)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reg_files_only) {
|
if (reg_files_only && !S_ISREG(pair->src_st.st_mode)) {
|
||||||
if (!S_ISREG(pair->src_st.st_mode)) {
|
message_warning(_("%s: Not a regular file, skipping"),
|
||||||
message_warning(_("%s: Not a regular file, "
|
pair->src_name);
|
||||||
"skipping"), pair->src_name);
|
goto error;
|
||||||
goto error;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// These are meaningless on Windows.
|
|
||||||
#ifndef TUKLIB_DOSLIKE
|
#ifndef TUKLIB_DOSLIKE
|
||||||
|
if (reg_files_only && !opt_force) {
|
||||||
if (pair->src_st.st_mode & (S_ISUID | S_ISGID)) {
|
if (pair->src_st.st_mode & (S_ISUID | S_ISGID)) {
|
||||||
// gzip rejects setuid and setgid files even
|
// gzip rejects setuid and setgid files even
|
||||||
// when --force was used. bzip2 doesn't check
|
// when --force was used. bzip2 doesn't check
|
||||||
|
@ -495,8 +494,8 @@ io_open_src_real(file_pair *pair)
|
||||||
"skipping"), pair->src_name);
|
"skipping"), pair->src_name);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue