From 6b3b3a502e5d96cd992470bd408dd7457139caf0 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 17 Jan 2016 11:38:40 -0500 Subject: [PATCH] Remove dead code in pg_dump. Coverity quite reasonably complained that this check for fout==NULL occurred after we'd already dereferenced fout. However, the check is just dead code since there is no code path by which CreateArchive can return a null pointer. Errors such as can't-open-that-file are reported down inside CreateArchive, and control doesn't return. So let's silence the warning by removing the dead code, rather than continuing to pretend it does something. Coverity didn't complain about this before 5b5fea2a1, so back-patch to 9.5 like that patch. --- src/bin/pg_dump/pg_dump.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 9585c58c65c..020a982712c 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -611,9 +611,6 @@ main(int argc, char **argv) /* Register the cleanup hook */ on_exit_close_archive(fout); - if (fout == NULL) - exit_horribly(NULL, "could not open output file \"%s\" for writing\n", filename); - /* Let the archiver know how noisy to be */ fout->verbose = g_verbose; -- 2.39.5