Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 025106e

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 42aa1c0 commit 025106e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/bin/pg_upgrade/file.c

+5-1
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;

src/bin/pg_upgrade/pg_upgrade.h

-2
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 '/'
@@ -82,7 +81,6 @@ extern char *output_files[];
8281
#define ECHO_QUOTE "'"
8382
#define ECHO_BLANK ""
8483
#else
85-
#define pg_copy_file CopyFile
8684
#define pg_mv_file pgrename
8785
#define pg_link_file win32_pghardlink
8886
#define PATH_SEPARATOR '\\'

0 commit comments

Comments
 (0)