1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-06 18:42:54 +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:28 -05:00
parent 7acad95463
commit f91c4e326a
13 changed files with 35 additions and 38 deletions

View File

@@ -234,18 +234,15 @@ get_user_info(char **user_name_p)
/*
* getErrorText()
*
* Returns the text of the error message for the given error number
*
* This feature is factored into a separate function because it is
* system-dependent.
* Returns the text of the most recent error
*/
const char *
getErrorText(int errNum)
getErrorText(void)
{
#ifdef WIN32
_dosmaperr(GetLastError());
#endif
return pg_strdup(strerror(errNum));
return pg_strdup(strerror(errno));
}