Skip to content

Commit d66b108

Browse files
committed
If we fail to rename pg_internal.init into place, delete the useless
temporary file. This seems to be a known failure mode under Cygwin, so we might as well expend the extra line of code to be tidy.
1 parent aa00e61 commit d66b108

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/backend/utils/cache/relcache.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.149 2001/11/05 17:46:30 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.150 2002/01/15 22:33:20 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2978,5 +2978,12 @@ write_irels(void)
29782978
* previously-existing init file.
29792979
*/
29802980
if (rename(tempfilename, finalfilename) < 0)
2981+
{
29812982
elog(NOTICE, "Cannot rename init file %s to %s: %m\n\tContinuing anyway, but there's something wrong.", tempfilename, finalfilename);
2983+
/*
2984+
* If we fail, try to clean up the useless temp file; don't bother
2985+
* to complain if this fails too.
2986+
*/
2987+
unlink(tempfilename);
2988+
}
29822989
}

0 commit comments

Comments
 (0)