Force the umask to something predictable while creating objects

on disk.  In particular, this fixes tar -xp restore of mode bits.
This commit is contained in:
kientzle 2007-03-02 16:44:58 +00:00
parent a02f7880b0
commit 11f5cfdca1

View File

@ -262,6 +262,7 @@ archive_read_extract(struct archive *a, struct archive_entry *entry, int flags)
if (stat(archive_entry_pathname(entry), &extract->st) == 0)
extract->pst = &extract->st;
extract->umask = umask(0); /* Set the umask to zero, record old one. */
if (extract->pst != NULL &&
extract->pst->st_dev == a->skip_file_dev &&
@ -295,7 +296,7 @@ archive_read_extract(struct archive *a, struct archive_entry *entry, int flags)
break;
}
}
umask(extract->umask); /* Restore umask. */
cleanup:
#ifdef HAVE_FCHDIR