Skip to content

Commit 13f41aa

Browse files
committed
mdcreate():
fd = FileNameOpenFile(path, O_RDWR|O_CREAT|O_EXCL, 0600); /* * If the file already exists and is empty, we pretend that the * create succeeded. During bootstrap processing, we skip that check, * because pg_time, pg_variable, and pg_log get created before their * .bki file entries are processed. * > * As the result of this pretence it was possible to have in > * pg_class > 1 records with the same relname. Actually, it > * should be fixed in upper levels, too, but... - vadim 05/06/97 > */
1 parent b45128f commit 13f41aa

File tree

1 file changed

+12
-10
lines changed
  • src/backend/storage/smgr

1 file changed

+12
-10
lines changed

src/backend/storage/smgr/md.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.11 1997/02/14 04:17:08 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.12 1997/05/06 02:03:20 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -99,7 +99,6 @@ int
9999
mdcreate(Relation reln)
100100
{
101101
int fd, vfd;
102-
int tmp;
103102
char *path;
104103
extern bool IsBootstrapProcessingMode();
105104

@@ -111,16 +110,19 @@ mdcreate(Relation reln)
111110
* create succeeded. During bootstrap processing, we skip that check,
112111
* because pg_time, pg_variable, and pg_log get created before their
113112
* .bki file entries are processed.
113+
*
114+
* As the result of this pretence it was possible to have in
115+
* pg_class > 1 records with the same relname. Actually, it
116+
* should be fixed in upper levels, too, but... - vadim 05/06/97
114117
*/
115118

116-
if (fd < 0) {
117-
if ((fd = FileNameOpenFile(path, O_RDWR, 0600)) >= 0) {
118-
if (!IsBootstrapProcessingMode() &&
119-
FileRead(fd, (char *) &tmp, sizeof(tmp)) != 0) {
120-
FileClose(fd);
121-
return (-1);
122-
}
123-
}
119+
if (fd < 0)
120+
{
121+
if ( !IsBootstrapProcessingMode() )
122+
return (-1);
123+
fd = FileNameOpenFile(path, O_RDWR, 0600); /* Bootstrap */
124+
if ( fd < 0 )
125+
return (-1);
124126
}
125127

126128
if (CurFd >= Nfds) {

0 commit comments

Comments
 (0)