Fix thinko introduced by 82a5649 in slot.c
authorMichael Paquier <michael@paquier.xyz>
Wed, 17 Apr 2019 01:01:22 +0000 (10:01 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 17 Apr 2019 01:01:22 +0000 (10:01 +0900)
When saving a replication slot, failing to close the temporary path used
to save the slot information is considered as a failure and reported as
such.  However the code forgot to leave immediately as other failure
paths do.

Noticed while looking up at this area of the code for another patch.

src/backend/replication/slot.c

index 057c5d7ab2ebc2bbb8aca14b4f25260cb76fdd18..55c306e465465779301c9a7ef787d455cb7ec70c 100644 (file)
@@ -1316,10 +1316,13 @@ SaveSlotToPath(ReplicationSlot *slot, const char *dir, int elevel)
        pgstat_report_wait_end();
 
        if (CloseTransientFile(fd))
+       {
                ereport(elevel,
                                (errcode_for_file_access(),
                                 errmsg("could not close file \"%s\": %m",
                                                tmppath)));
+               return;
+       }
 
        /* rename to permanent file, fsync file and directory */
        if (rename(tmppath, path) != 0)