1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

pg_upgrade: fix CopyFile() on Windows to fail on file existence

Also fix getErrorText() to return the right error string on failure.
This behavior now matches that of other operating systems.

Report by Noah Misch

Backpatch through 9.1
This commit is contained in:
Bruce Momjian
2015-11-24 17:18:27 -05:00
parent 6df62ef43e
commit c36064e438
2 changed files with 3 additions and 1 deletions

View File

@ -41,7 +41,7 @@ copyAndUpdateFile(pageCnvCtx *pageConverter,
#ifndef WIN32
if (copy_file(src, dst, force) == -1)
#else
if (CopyFile(src, dst, force) == 0)
if (CopyFile(src, dst, !force) == 0)
#endif
return getErrorText(errno);
else