Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 36aaf25

Browse files
committed
Correct permissions on lo_export(). Open up permissions.
1 parent 3f53311 commit 36aaf25

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/libpq/be-fsstubs.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.4 1996/11/06 08:48:25 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.5 1996/11/15 18:38:20 momjian Exp $
1111
*
1212
* NOTES
1313
* This should be moved to a more appropriate place. It is here
@@ -24,6 +24,7 @@
2424

2525
#include <fcntl.h>
2626
#include <sys/types.h>
27+
#include <sys/stat.h>
2728
#include <unistd.h>
2829

2930
#include <postgres.h>
@@ -240,7 +241,7 @@ lo_import(text *filename)
240241
char buf[BUFSIZE];
241242
LargeObjectDesc *lobj;
242243
Oid lobjOid;
243-
244+
244245
/*
245246
* open the file to be read in
246247
*/
@@ -294,6 +295,7 @@ lo_export(Oid lobjId, text *filename)
294295
#define BUFSIZE 1024
295296
char buf[BUFSIZE];
296297
LargeObjectDesc *lobj;
298+
mode_t oumask;
297299

298300
/*
299301
* create an inversion "object"
@@ -307,7 +309,9 @@ lo_export(Oid lobjId, text *filename)
307309
/*
308310
* open the file to be written to
309311
*/
312+
oumask = umask((mode_t) 0);
310313
fd = open(VARDATA(filename), O_CREAT|O_WRONLY, 0666);
314+
(void) umask(oumask);
311315
if (fd < 0) { /* error */
312316
elog(WARN, "lo_export: can't open unix file\"%s\"",
313317
VARDATA(filename));

0 commit comments

Comments
 (0)