Index: src/xz/file_io.c |
=================================================================== |
--- src/xz/file_io.c (revision 50504) |
+++ src/xz/file_io.c (working copy) |
@@ -53,7 +53,7 @@ |
extern void |
io_init(void) |
{ |
- // Make sure that stdin, stdout, and and stderr are connected to |
+ // Make sure that stdin, stdout, and stderr are connected to |
// a valid file descriptor. Exit immediately with exit code ERROR |
// if we cannot make the file descriptors valid. Maybe we should |
// print an error message, but our stderr could be screwed anyway. |
@@ -370,15 +370,16 @@ |
} |
#ifdef O_NOFOLLOW |
- // Give an understandable error message in if reason |
+ // Give an understandable error message if the reason |
// for failing was that the file was a symbolic link. |
// |
// Note that at least Linux, OpenBSD, Solaris, and Darwin |
- // use ELOOP to indicate if O_NOFOLLOW was the reason |
+ // use ELOOP to indicate that O_NOFOLLOW was the reason |
// that open() failed. Because there may be |
// directories in the pathname, ELOOP may occur also |
// because of a symlink loop in the directory part. |
- // So ELOOP doesn't tell us what actually went wrong. |
+ // So ELOOP doesn't tell us what actually went wrong, |
+ // and this stupidity went into POSIX-1.2008 too. |
// |
// FreeBSD associates EMLINK with O_NOFOLLOW and |
// Tru64 uses ENOTSUP. We use these directly here |
@@ -396,10 +397,10 @@ |
was_symlink = true; |
# elif defined(__NetBSD__) |
- // FIXME? As of 2008-11-20, NetBSD doesn't document what |
- // errno is used with O_NOFOLLOW. It seems to be EFTYPE, |
- // but since it isn't documented, it may be wrong to rely |
- // on it here. |
+ // As of 2010-09-05, NetBSD doesn't document what errno is |
+ // used with O_NOFOLLOW. It is EFTYPE though, and I |
+ // understood that is very unlikely to change even though |
+ // it is undocumented. |
if (errno == EFTYPE) |
was_symlink = true; |
@@ -456,15 +457,14 @@ |
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 |
@@ -494,8 +494,8 @@ |
"skipping"), pair->src_name); |
goto error; |
} |
+ } |
#endif |
- } |
return false; |