summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2015-09-22 23:37:26 -0400
committerNoah Misch <noah@leadboat.com>2015-09-22 23:37:26 -0400
commitc69e7d5c78af946b22d46afc60823d20197ca3e3 (patch)
tree5b7215dbded64095add88fb55e26f254383231d6
parent68e83c12088aa2272ccdd632a37d647ea67548a0 (diff)
downloadpostgresql-c69e7d5c78af946b22d46afc60823d20197ca3e3.tar.gz
Skip recently-added umask() call on Windows.
Symbols S_IRWXG and S_IRWXO became available to Windows builds in commit 1319002e2ee166c06b38cdbc5e8508c7205fa115, so PostgreSQL 9.0 cannot use them in platform-independent code. Rewrite commit 24aed2124a5273e4cb543b06d4b7bb2c2ad5bf3c to not change Windows builds. The new umask() call had no effect on Windows, anyway. Per buildfarm.
-rw-r--r--src/bin/pg_dump/pg_backup_tar.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c
index 51adf7917e..75cc8dd4bd 100644
--- a/src/bin/pg_dump/pg_backup_tar.c
+++ b/src/bin/pg_dump/pg_backup_tar.c
@@ -375,20 +375,23 @@ tarOpen(ArchiveHandle *AH, const char *filename, char mode)
}
else
{
- int old_umask;
-
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
- tm->tmpFH = tmpfile();
+ {
+ int old_umask;
+
+ /*
+ * 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);
+ tm->tmpFH = tmpfile();
+ umask(old_umask);
+ }
#else
/*
@@ -421,8 +424,6 @@ tarOpen(ArchiveHandle *AH, const char *filename, char mode)
if (tm->tmpFH == NULL)
die_horribly(AH, modulename, "could not generate temporary file name: %s\n", strerror(errno));
- umask(old_umask);
-
#ifdef HAVE_LIBZ
if (AH->compression != 0)