Skip to content

Commit 87cdfeb

Browse files
committed
pg_upgrade: properly detect file copy failure on Windows
Previously, file copy failures were ignored on Windows due to an incorrect return value check. Report by Manu Joye Backpatch through 9.1
1 parent 40879a9 commit 87cdfeb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

contrib/pg_upgrade/file.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ copyAndUpdateFile(pageCnvCtx *pageConverter,
3434
{
3535
if (pageConverter == NULL)
3636
{
37-
if (pg_copy_file(src, dst, force) == -1)
37+
#ifndef WIN32
38+
if (copy_file(src, dst, force) == -1)
39+
#else
40+
if (CopyFile(src, dst, force) == 0)
41+
#endif
3842
return getErrorText(errno);
3943
else
4044
return NULL;

contrib/pg_upgrade/pg_upgrade.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ extern char *output_files[];
7070

7171

7272
#ifndef WIN32
73-
#define pg_copy_file copy_file
7473
#define pg_mv_file rename
7574
#define pg_link_file link
7675
#define PATH_SEPARATOR '/'
@@ -80,7 +79,6 @@ extern char *output_files[];
8079
#define ECHO_QUOTE "'"
8180
#define ECHO_BLANK ""
8281
#else
83-
#define pg_copy_file CopyFile
8482
#define pg_mv_file pgrename
8583
#define pg_link_file win32_pghardlink
8684
#define PATH_SEPARATOR '\\'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy