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
This commit is contained in:
Yaroslav Tykhiy 2005-09-09 19:02:03 +00:00
parent 628f88b8b4
commit 628bcb899b

View File

@ -1054,10 +1054,13 @@ set_perm(struct archive *a, int fd, struct archive_entry *entry,
*/ */
if (!S_ISLNK(archive_entry_mode(entry))) { if (!S_ISLNK(archive_entry_mode(entry))) {
#ifdef HAVE_FCHMOD #ifdef HAVE_FCHMOD
if (fd >= 0 && fchmod(fd, mode) != 0) { if (fd >= 0) {
archive_set_error(a, errno, "Can't set permissions"); if (fchmod(fd, mode) != 0) {
return (ARCHIVE_WARN); archive_set_error(a, errno,
} "Can't set permissions");
return (ARCHIVE_WARN);
}
} else
#endif #endif
if (chmod(name, mode) != 0) { if (chmod(name, mode) != 0) {
archive_set_error(a, errno, "Can't set permissions"); archive_set_error(a, errno, "Can't set permissions");