Skip to content
Snippets Groups Projects
Commit 025106e3 authored by Bruce Momjian's avatar Bruce Momjian
Browse files

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
parent 42aa1c03
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,11 @@ copyAndUpdateFile(pageCnvCtx *pageConverter, ...@@ -34,7 +34,11 @@ copyAndUpdateFile(pageCnvCtx *pageConverter,
{ {
if (pageConverter == NULL) if (pageConverter == NULL)
{ {
if (pg_copy_file(src, dst, force) == -1) #ifndef WIN32
if (copy_file(src, dst, force) == -1)
#else
if (CopyFile(src, dst, force) == 0)
#endif
return getErrorText(errno); return getErrorText(errno);
else else
return NULL; return NULL;
......
...@@ -70,7 +70,6 @@ extern char *output_files[]; ...@@ -70,7 +70,6 @@ extern char *output_files[];
#ifndef WIN32 #ifndef WIN32
#define pg_copy_file copy_file
#define pg_mv_file rename #define pg_mv_file rename
#define pg_link_file link #define pg_link_file link
#define PATH_SEPARATOR '/' #define PATH_SEPARATOR '/'
...@@ -82,7 +81,6 @@ extern char *output_files[]; ...@@ -82,7 +81,6 @@ extern char *output_files[];
#define ECHO_QUOTE "'" #define ECHO_QUOTE "'"
#define ECHO_BLANK "" #define ECHO_BLANK ""
#else #else
#define pg_copy_file CopyFile
#define pg_mv_file pgrename #define pg_mv_file pgrename
#define pg_link_file win32_pghardlink #define pg_link_file win32_pghardlink
#define PATH_SEPARATOR '\\' #define PATH_SEPARATOR '\\'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment