Include error code in message from pg_upgrade

In passing, also quote the filename in one message where it wasn't.

Author: Dagfinn Ilmari Mannsåker
Discussion: https://postgr.es/m/87pne2w98h.fsf@wibble.ilmari.org
This commit is contained in:
Magnus Hagander 2020-02-26 10:03:11 +01:00
parent 59f9cd9dd5
commit 4109bb5de4
1 changed files with 2 additions and 2 deletions

View File

@ -164,11 +164,11 @@ get_major_server_version(ClusterInfo *cluster)
snprintf(ver_filename, sizeof(ver_filename), "%s/PG_VERSION",
cluster->pgdata);
if ((version_fd = fopen(ver_filename, "r")) == NULL)
pg_fatal("could not open version file: %s\n", ver_filename);
pg_fatal("could not open version file \"%s\": %m\n", ver_filename);
if (fscanf(version_fd, "%63s", cluster->major_version_str) == 0 ||
sscanf(cluster->major_version_str, "%d.%d", &v1, &v2) < 1)
pg_fatal("could not parse PG_VERSION file from %s\n", cluster->pgdata);
pg_fatal("could not parse PG_VERSION file from \"%s\"\n", cluster->pgdata);
fclose(version_fd);