summaryrefslogtreecommitdiff
path: root/contrib/pg_upgrade/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pg_upgrade/file.c')
-rw-r--r--contrib/pg_upgrade/file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/pg_upgrade/file.c b/contrib/pg_upgrade/file.c
index 11f1d4bbcbd..473b029d0ae 100644
--- a/contrib/pg_upgrade/file.c
+++ b/contrib/pg_upgrade/file.c
@@ -74,7 +74,10 @@ copyAndUpdateFile(migratorContext *ctx, pageCnvCtx *pageConverter,
return "can't open source file";
if ((dstfd = open(dst, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) < 0)
+ {
+ fclose(src_fd);
return "can't create destination file";
+ }
while ((bytesRead = read(src_fd, buf, BLCKSZ)) == BLCKSZ)
{