mirror of
https://github.com/postgres/postgres.git
synced 2025-08-08 06:02:22 +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:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user