aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-09-05 23:24:53 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-09-05 23:24:53 +0000
commitb9d01fe288e0d2cfbb8967f475f0307413ed6112 (patch)
tree03456279b9252690d485cfc0cc9ec989892a3366
parent0041202b98dd6b5b24a4ac9e034e96ef7104f4bb (diff)
downloadpostgresql-b9d01fe288e0d2cfbb8967f475f0307413ed6112.tar.gz
postgresql-b9d01fe288e0d2cfbb8967f475f0307413ed6112.zip
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.
-rw-r--r--src/backend/storage/smgr/md.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 2b10060729f..304dc786f29 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -7,7 +7,7 @@
*
*
* 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);
#endif
- /* this should only happen during bootstrap processing */
if (fd < 0)
+ {
+ /* in bootstrap mode, accept mdopen as substitute for mdcreate */
+ if (IsBootstrapProcessingMode())
+ {
#ifndef __CYGWIN32__
- fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
+ fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
#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
+ }
+ if (fd < 0)
+ {
+ elog(ERROR, "mdopen: couldn't open %s: %m", path);
+ return -1;
+ }
+ }
vfd = _fdvec_alloc();
if (vfd < 0)