From 3972ed503235e3550d54ab28e67fec0fe658ece8 Mon Sep 17 00:00:00 2001 From: yar Date: Fri, 9 Sep 2005 19:02:03 +0000 Subject: 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 --- lib/libarchive/archive_read_extract.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') 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"); -- cgit v1.1