If we fail to rename pg_internal.init into place, delete the useless
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Jan 2002 22:33:20 +0000 (22:33 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Jan 2002 22:33:20 +0000 (22:33 +0000)
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.

src/backend/utils/cache/relcache.c

index 4f6c571355e81a11f7cba7984b2030b2c2fa4ba5..7cb561a3ff0221bf213c405e2d8a55e493230c32 100644 (file)
@@ -2978,5 +2978,12 @@ write_irels(void)
         * previously-existing init file.
         */
        if (rename(tempfilename, finalfilename) < 0)
+       {
                elog(NOTICE, "Cannot rename init file %s to %s: %m\n\tContinuing anyway, but there's something wrong.", tempfilename, finalfilename);
+               /*
+                * If we fail, try to clean up the useless temp file; don't bother
+                * to complain if this fails too.
+                */
+               unlink(tempfilename);
+       }
 }