Content-Length: 301802 | pFad | http://github.com/postgrespro/postgres/commit/025106e314627f5aacdf72fca52ba0ed985d696e

CC pg_upgrade: properly detect file copy failure on Windows · postgrespro/postgres@025106e · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/025106e314627f5aacdf72fca52ba0ed985d696e

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy