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

Commit 6cc6f18

Browse files
committed
open(2) flags saved for re-opening a virtual file should probably not
include O_CREAT.
1 parent 503c80d commit 6cc6f18

File tree

1 file changed

+5
-3
lines changed
  • src/backend/storage/file

1 file changed

+5
-3
lines changed

src/backend/storage/file/fd.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.74 2001/03/22 03:59:45 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.75 2001/04/03 02:31:52 tgl Exp $
1111
*
1212
* NOTES:
1313
*
@@ -112,7 +112,7 @@ typedef struct vfd
112112
long seekPos; /* current logical file position */
113113
char *fileName; /* name of file, or NULL for unused VFD */
114114
/* NB: fileName is malloc'd, and must be free'd when closing the VFD */
115-
int fileFlags; /* open(2) flags for opening the file */
115+
int fileFlags; /* open(2) flags for (re)opening the file */
116116
int fileMode; /* mode to pass to open(2) */
117117
} Vfd;
118118

@@ -681,8 +681,10 @@ fileNameOpenFile(FileName fileName,
681681
vfdP->fileName = malloc(strlen(fileName) + 1);
682682
strcpy(vfdP->fileName, fileName);
683683

684-
vfdP->fileFlags = fileFlags & ~(O_TRUNC | O_EXCL);
684+
/* Saved flags are adjusted to be OK for re-opening file */
685+
vfdP->fileFlags = fileFlags & ~(O_CREAT | O_TRUNC | O_EXCL);
685686
vfdP->fileMode = fileMode;
687+
686688
vfdP->seekPos = 0;
687689

688690
/*

0 commit comments

Comments
 (0)