Per Tatsuo's recommendation, change mdopen so that it won't
automatically create the file, except during bootstrap mode where that seems to be necessary.
This commit is contained in:
parent
0041202b98
commit
b9d01fe288
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.52 1999/09/02 02:57:49 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.53 1999/09/05 23:24:53 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -284,13 +284,23 @@ mdopen(Relation reln)
|
|||||||
fd = FileNameOpenFile(path, O_RDWR | O_BINARY, 0600);
|
fd = FileNameOpenFile(path, O_RDWR | O_BINARY, 0600);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* this should only happen during bootstrap processing */
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
/* in bootstrap mode, accept mdopen as substitute for mdcreate */
|
||||||
|
if (IsBootstrapProcessingMode())
|
||||||
|
{
|
||||||
#ifndef __CYGWIN32__
|
#ifndef __CYGWIN32__
|
||||||
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
|
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
|
||||||
#else
|
#else
|
||||||
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
|
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
elog(ERROR, "mdopen: couldn't open %s: %m", path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vfd = _fdvec_alloc();
|
vfd = _fdvec_alloc();
|
||||||
if (vfd < 0)
|
if (vfd < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user