summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2005-09-09 19:02:03 +0000
committeryar <yar@FreeBSD.org>2005-09-09 19:02:03 +0000
commit3972ed503235e3550d54ab28e67fec0fe658ece8 (patch)
tree8f811bc6198053d4a6a1566961cb5bc8ee15c7d1 /lib
parenta540da528c1c1002448092ac37f3a4df3ef9c588 (diff)
downloadFreeBSD-src-3972ed503235e3550d54ab28e67fec0fe658ece8.zip
FreeBSD-src-3972ed503235e3550d54ab28e67fec0fe658ece8.tar.gz
Fix fallout from the previous commit:
We shouldn't call chmod() if we've just used fchmod() OK on the same file. Approved by: kientzle
Diffstat (limited to 'lib')
-rw-r--r--lib/libarchive/archive_read_extract.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libarchive/archive_read_extract.c b/lib/libarchive/archive_read_extract.c
index 9e851bb..cde42b8 100644
--- a/lib/libarchive/archive_read_extract.c
+++ b/lib/libarchive/archive_read_extract.c
@@ -1054,10 +1054,13 @@ set_perm(struct archive *a, int fd, struct archive_entry *entry,
*/
if (!S_ISLNK(archive_entry_mode(entry))) {
#ifdef HAVE_FCHMOD
- if (fd >= 0 && fchmod(fd, mode) != 0) {
- archive_set_error(a, errno, "Can't set permissions");
- return (ARCHIVE_WARN);
- }
+ if (fd >= 0) {
+ if (fchmod(fd, mode) != 0) {
+ archive_set_error(a, errno,
+ "Can't set permissions");
+ return (ARCHIVE_WARN);
+ }
+ } else
#endif
if (chmod(name, mode) != 0) {
archive_set_error(a, errno, "Can't set permissions");
OpenPOWER on IntegriCloud