mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Correct permissions on lo_export(). Open up permissions.
This commit is contained in:
		@@ -7,7 +7,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * IDENTIFICATION
 | 
					 * IDENTIFICATION
 | 
				
			||||||
 *    $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.4 1996/11/06 08:48:25 scrappy Exp $
 | 
					 *    $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.5 1996/11/15 18:38:20 momjian Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * NOTES
 | 
					 * NOTES
 | 
				
			||||||
 *    This should be moved to a more appropriate place.  It is here
 | 
					 *    This should be moved to a more appropriate place.  It is here
 | 
				
			||||||
@@ -24,6 +24,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <fcntl.h>
 | 
					#include <fcntl.h>
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
 | 
					#include <sys/stat.h>
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <postgres.h>
 | 
					#include <postgres.h>
 | 
				
			||||||
@@ -294,6 +295,7 @@ lo_export(Oid lobjId, text *filename)
 | 
				
			|||||||
#define BUFSIZE        1024
 | 
					#define BUFSIZE        1024
 | 
				
			||||||
    char buf[BUFSIZE];
 | 
					    char buf[BUFSIZE];
 | 
				
			||||||
    LargeObjectDesc *lobj;
 | 
					    LargeObjectDesc *lobj;
 | 
				
			||||||
 | 
					    mode_t oumask;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * create an inversion "object"
 | 
					     * create an inversion "object"
 | 
				
			||||||
@@ -307,7 +309,9 @@ lo_export(Oid lobjId, text *filename)
 | 
				
			|||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * open the file to be written to
 | 
					     * open the file to be written to
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					    oumask = umask((mode_t) 0);
 | 
				
			||||||
    fd = open(VARDATA(filename), O_CREAT|O_WRONLY, 0666);
 | 
					    fd = open(VARDATA(filename), O_CREAT|O_WRONLY, 0666);
 | 
				
			||||||
 | 
					    (void) umask(oumask);
 | 
				
			||||||
    if (fd < 0)  {   /* error */
 | 
					    if (fd < 0)  {   /* error */
 | 
				
			||||||
	elog(WARN, "lo_export: can't open unix file\"%s\"",
 | 
						elog(WARN, "lo_export: can't open unix file\"%s\"",
 | 
				
			||||||
	     VARDATA(filename));
 | 
						     VARDATA(filename));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user