From: Peter Eisentraut Date: Thu, 3 Oct 2013 01:05:08 +0000 (-0400) Subject: psql: Set up cancel handler later X-Git-Tag: REL9_4_BETA1~1113 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9099e4afe0e4101bc79f078be3e15639a048e633;p=thirdparty%2Fpostgresql.git psql: Set up cancel handler later The cancel handler was uselessly set up even before the first connection was opened. By setting it up afterwards, the user can use Ctrl+C to abort psql if the initial connection attempt hangs. Reviewed-by: Dean Rasheed Reviewed-by: Ryan Kelly --- diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index b2264c91fac..dc06f667027 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; @@ -246,6 +244,8 @@ main(int argc, char *argv[]) exit(EXIT_BADCONN); } + setup_cancel_handler(); + PQsetNoticeProcessor(pset.db, NoticeProcessor, NULL); SyncVariables();