diff options
Diffstat (limited to 'contrib/pg_upgrade/file.c')
-rw-r--r-- | contrib/pg_upgrade/file.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/pg_upgrade/file.c b/contrib/pg_upgrade/file.c index fcf1c440a70..0276636e03f 100644 --- a/contrib/pg_upgrade/file.c +++ b/contrib/pg_upgrade/file.c @@ -316,3 +316,19 @@ win32_pghardlink(const char *src, const char *dst) } #endif + + +/* fopen() file with no group/other permissions */ +FILE * +fopen_priv(const char *path, const char *mode) +{ + mode_t old_umask = umask(S_IRWXG | S_IRWXO); + FILE *fp; + + fp = fopen(path, mode); + umask(old_umask); + + return fp; +} + + |