diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2013-10-01 21:24:56 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2013-10-09 22:48:41 -0400 |
commit | 264aa14a2f687eba8c8cc2a5b6cbd6397973da98 (patch) | |
tree | fa09ac5e9755f556542e71c4f74d8881438822a2 /contrib/pg_upgrade/server.c | |
parent | 261c7d4b653bc3e44c31fd456d94f292caa50d8f (diff) | |
download | postgresql-264aa14a2f687eba8c8cc2a5b6cbd6397973da98.tar.gz |
pg_upgrade: Split off pg_fatal() from pg_log()
This allows decorating pg_fatal() with noreturn compiler hints, leading
to better diagnostics.
Reviewed-by: Marko Tiikkaja <marko@joh.to>
Diffstat (limited to 'contrib/pg_upgrade/server.c')
-rw-r--r-- | contrib/pg_upgrade/server.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/contrib/pg_upgrade/server.c b/contrib/pg_upgrade/server.c index 1ad85cf715..b75f5530ed 100644 --- a/contrib/pg_upgrade/server.c +++ b/contrib/pg_upgrade/server.c @@ -149,12 +149,12 @@ 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_log(PG_FATAL, "could not open version file: %s\n", ver_filename); + pg_fatal("could not open version file: %s\n", ver_filename); if (fscanf(version_fd, "%63s", cluster->major_version_str) == 0 || sscanf(cluster->major_version_str, "%d.%d", &integer_version, &fractional_version) != 2) - pg_log(PG_FATAL, "could not get version from %s\n", cluster->pgdata); + pg_fatal("could not get version from %s\n", cluster->pgdata); fclose(version_fd); @@ -270,7 +270,7 @@ start_postmaster(ClusterInfo *cluster, bool throw_error) PQerrorMessage(conn)); if (conn) PQfinish(conn); - pg_log(PG_FATAL, "could not connect to %s postmaster started with the command:\n" + pg_fatal("could not connect to %s postmaster started with the command:\n" "%s\n", CLUSTER_NAME(cluster), cmd); } @@ -281,7 +281,7 @@ start_postmaster(ClusterInfo *cluster, bool throw_error) * enabled, fail now. This could happen if the server was already running. */ if (!pg_ctl_return) - pg_log(PG_FATAL, "pg_ctl failed to start the %s server, or connection failed\n", + pg_fatal("pg_ctl failed to start the %s server, or connection failed\n", CLUSTER_NAME(cluster)); return true; @@ -336,8 +336,7 @@ check_pghost_envvar(void) /* check for 'local' host values */ (strcmp(value, "localhost") != 0 && strcmp(value, "127.0.0.1") != 0 && strcmp(value, "::1") != 0 && value[0] != '/')) - pg_log(PG_FATAL, - "libpq environment variable %s has a non-local server value: %s\n", + pg_fatal("libpq environment variable %s has a non-local server value: %s\n", option->envvar, value); } } |