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
#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
{
#ifdef WIN32
_dosmaperr(GetLastError());
+ /* _dosmaperr sets errno, so we copy errno here */
+ errNum = errno;
#endif
return pg_strdup(strerror(errNum));
}