1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-18 04:29:09 +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 cbd96eff25
commit 13b30c16f3
12 changed files with 28 additions and 31 deletions

View File

@@ -191,7 +191,7 @@ pid_lock_file_exists(const char *datadir)
/* ENOTDIR means we will throw a more useful error later */
if (errno != ENOENT && errno != ENOTDIR)
pg_fatal("could not open file \"%s\" for reading: %s\n",
path, getErrorText(errno));
path, getErrorText());
return false;
}
@@ -285,7 +285,7 @@ check_data_dir(const char *pg_data)
if (stat(subDirName, &statBuf) != 0)
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
subDirName, getErrorText(errno));
subDirName, getErrorText());
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
subDirName);
@@ -309,7 +309,7 @@ check_bin_dir(ClusterInfo *cluster)
/* check bindir */
if (stat(cluster->bindir, &statBuf) != 0)
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
cluster->bindir, getErrorText(errno));
cluster->bindir, getErrorText());
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
cluster->bindir);
@@ -352,7 +352,7 @@ validate_exec(const char *dir, const char *cmdName)
*/
if (stat(path, &buf) < 0)
pg_fatal("check for \"%s\" failed: %s\n",
path, getErrorText(errno));
path, getErrorText());
else if (!S_ISREG(buf.st_mode))
pg_fatal("check for \"%s\" failed: not an executable file\n",
path);