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

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;

src/bin/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 '/'
@@ -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)
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