1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

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
This commit is contained in:
Bruce Momjian
2015-11-14 11:47:11 -05:00
parent 7fe1d1cfbf
commit bdcbc2b471
2 changed files with 5 additions and 3 deletions

View File

@ -38,7 +38,11 @@ copyAndUpdateFile(pageCnvCtx *pageConverter,
{
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);
else
return NULL;

View File

@ -35,7 +35,6 @@
#define DB_DUMP_FILE "pg_upgrade_dump_db.sql"
#ifndef WIN32
#define pg_copy_file copy_file
#define pg_mv_file rename
#define pg_link_file link
#define PATH_SEPARATOR '/'
@ -43,7 +42,6 @@
#define RMDIR_CMD "rm -rf"
#define SCRIPT_EXT "sh"
#else
#define pg_copy_file CopyFile
#define pg_mv_file pgrename
#define pg_link_file win32_pghardlink
#define sleep(x) Sleep(x * 1000)