summaryrefslogtreecommitdiff
path: root/src/bin/pg_upgrade/file.c
diff options
context:
space:
mode:
authorBruce Momjian2015-11-24 22:18:28 +0000
committerBruce Momjian2015-11-24 22:18:28 +0000
commit13b30c16f3164ee70599adee251256bd069fa0e4 (patch)
treef05c1ad38d0aefeab81b16c5e544f7db3ee6fa71 /src/bin/pg_upgrade/file.c
parentcbd96eff251bf92e88a13ef00df07c6caae0d411 (diff)
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
Diffstat (limited to 'src/bin/pg_upgrade/file.c')
-rw-r--r--src/bin/pg_upgrade/file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bin/pg_upgrade/file.c b/src/bin/pg_upgrade/file.c
index 37eb832c93a..c84783c9de6 100644
--- a/src/bin/pg_upgrade/file.c
+++ b/src/bin/pg_upgrade/file.c
@@ -37,9 +37,9 @@ 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);
+ return getErrorText();
else
return NULL;
}
@@ -121,7 +121,7 @@ linkAndUpdateFile(pageCnvCtx *pageConverter,
return "Cannot in-place update this cluster, page-by-page conversion is required";
if (pg_link_file(src, dst) == -1)
- return getErrorText(errno);
+ return getErrorText();
else
return NULL;
}
@@ -219,7 +219,7 @@ check_hard_link(void)
{
pg_fatal("Could not create hard link between old and new data directories: %s\n"
"In link mode the old and new data directories must be on the same file system volume.\n",
- getErrorText(errno));
+ getErrorText());
}
unlink(new_link_file);
}