1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

While changing Cygwin Python to build its core as a DLL (like Win32

Python) to support shared extension modules, I have learned that Guido
prefers the style of the attached patch to solve the above problem.
I feel that this solution is particularly appropriate in this case
because the following:

    PglargeType
    PgType
    PgQueryType

are already being handled in the way that I am proposing for PgSourceType.

Jason Tishler
This commit is contained in:
Bruce Momjian
2001-05-25 15:34:50 +00:00
parent 3f7c542a60
commit dffb673692
10 changed files with 210 additions and 20 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.76 2001/04/03 04:07:02 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.77 2001/05/25 15:34:50 momjian Exp $
*
* NOTES:
*
@ -742,21 +742,29 @@ PathNameOpenFile(FileName fileName, int fileFlags, int fileMode)
File
OpenTemporaryFile(void)
{
char tempfilename[64];
char tempfilepath[128];
File file;
/*
* Generate a tempfile name that's unique within the current
* transaction
*/
snprintf(tempfilename, sizeof(tempfilename),
"pg_sorttemp%d.%ld", MyProcPid, tempFileCounter++);
snprintf(tempfilepath, sizeof(tempfilepath),
"%s%c%d.%ld", SORT_TEMP_DIR, SEP_CHAR, MyProcPid,
tempFileCounter++);
/* Open the file */
file = FileNameOpenFile(tempfilename,
file = FileNameOpenFile(tempfilepath,
O_RDWR | O_CREAT | O_TRUNC | PG_BINARY, 0600);
if (file <= 0)
elog(ERROR, "Failed to create temporary file %s", tempfilename);
{
/* mkdir could fail if some one else already created it */
mkdir(SORT_TEMP_DIR, S_IRWXU);
file = FileNameOpenFile(tempfilepath,
O_RDWR | O_CREAT | O_TRUNC | PG_BINARY, 0600);
if (file <= 0)
elog(ERROR, "Failed to create temporary file %s", tempfilepath);
}
/* Mark it for deletion at close or EOXact */
VfdCache[file].fdstate |= FD_TEMPORARY;