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))) {
#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");