|
|
|
@ -372,8 +372,18 @@ tarOpen(ArchiveHandle *AH, const char *filename, char mode) |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
int old_umask; |
|
|
|
|
|
|
|
|
|
|
|
tm = calloc(1, sizeof(TAR_MEMBER)); |
|
|
|
tm = calloc(1, sizeof(TAR_MEMBER)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* POSIX does not require, but permits, tmpfile() to restrict file |
|
|
|
|
|
|
|
* permissions. Given an OS crash after we write data, the filesystem |
|
|
|
|
|
|
|
* might retain the data but forget tmpfile()'s unlink(). If so, the |
|
|
|
|
|
|
|
* file mode protects confidentiality of the data written. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
old_umask = umask(S_IRWXG | S_IRWXO); |
|
|
|
|
|
|
|
|
|
|
|
#ifndef WIN32 |
|
|
|
#ifndef WIN32 |
|
|
|
tm->tmpFH = tmpfile(); |
|
|
|
tm->tmpFH = tmpfile(); |
|
|
|
#else |
|
|
|
#else |
|
|
|
@ -408,6 +418,8 @@ tarOpen(ArchiveHandle *AH, const char *filename, char mode) |
|
|
|
if (tm->tmpFH == NULL) |
|
|
|
if (tm->tmpFH == NULL) |
|
|
|
die_horribly(AH, modulename, "could not generate temporary file name: %s\n", strerror(errno)); |
|
|
|
die_horribly(AH, modulename, "could not generate temporary file name: %s\n", strerror(errno)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
umask(old_umask); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBZ |
|
|
|
#ifdef HAVE_LIBZ |
|
|
|
|
|
|
|
|
|
|
|
if (AH->compression != 0) |
|
|
|
if (AH->compression != 0) |
|
|
|
|