diff options
author | Daniel Gustafsson | 2022-08-31 11:06:50 +0000 |
---|---|---|
committer | Daniel Gustafsson | 2022-08-31 11:06:50 +0000 |
commit | cad4323cd345ec91fbe8d118436d3d50fa53c300 (patch) | |
tree | 7cc26e31618c99a39809ace7887a1dbccedc0829 /src/bin/pg_upgrade/version.c | |
parent | 7d5852ca83f4103d806ee7501f70b9354345f65d (diff) |
Refactor check_ functions to use filehandle for status
When reporting failure in check_ functions there is (typically) a text-
file mentioned in the error report which contains further details. Some
check_ functions kept a separate flag variable to indicate failure, and
some just checked the state of the filehandle as it's guaranteed to be
open when the check failed. This refactors the functions to consistently
do the same check on error reporting. As the error report contains the
filepath, it makes more sense to check the filehandle state and skip the
flag variable.
Reviewed-by: Nathan Bossart <[email protected]>
Reviewed-by: Bruce Momjian <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/bin/pg_upgrade/version.c')
-rw-r--r-- | src/bin/pg_upgrade/version.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c index d2636ba857f..064d23797c5 100644 --- a/src/bin/pg_upgrade/version.c +++ b/src/bin/pg_upgrade/version.c @@ -391,7 +391,6 @@ report_extension_updates(ClusterInfo *cluster) { int dbnum; FILE *script = NULL; - bool found = false; char *output_path = "update_extensions.sql"; prep_status("Checking for extension updates"); @@ -417,8 +416,6 @@ report_extension_updates(ClusterInfo *cluster) i_name = PQfnumber(res, "name"); for (rowno = 0; rowno < ntups; rowno++) { - found = true; - if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL) pg_fatal("could not open file \"%s\": %s", output_path, strerror(errno)); @@ -442,10 +439,8 @@ report_extension_updates(ClusterInfo *cluster) } if (script) - fclose(script); - - if (found) { + fclose(script); report_status(PG_REPORT, "notice"); pg_log(PG_REPORT, "\n" "Your installation contains extensions that should be updated\n" |