The signal handler installed by setup_cancel_handler() will ignore
attempts to exit psql should a host be unreachable. Since the
functionality it provides won't be used until later, it doesn't make
sense to set it up so early. Therefore, move the signal handler closer
to where it is first needed.
---
 src/bin/psql/startup.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 8b1864c..e53d84c 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -111,8 +111,6 @@ main(int argc, char *argv[])
        setvbuf(stderr, NULL, _IONBF, 0);
 #endif
 
-       setup_cancel_handler();
-
        pset.progname = get_progname(argv[0]);
 
        pset.db = NULL;
@@ -245,8 +243,9 @@ main(int argc, char *argv[])
        }
 
        /*
-        * Now find something to do
+        * Now find something to do (and handle cancellation, if applicable)
         */
+       setup_cancel_handler();
 
        /*
         * process file given by -f
-- 
1.7.7.4

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to