[PATCH] Prevent hanging on unreachable hosts on startup - Mailing list pgsql-bugs

From Ryan P. Kelly
Subject [PATCH] Prevent hanging on unreachable hosts on startup
Date
Msg-id 20120105011730.GA26760@llserver.lakeliving.com
Whole thread Raw
Responses Re: [PATCH] Prevent hanging on unreachable hosts on startup  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #6379: SQL Function Causes Back-end Crash
Next
From: dean.w.schulze@gmail.com
Date:
Subject: BUG #6380: dropdb gives error while loading shared libraries: liblber-2.3.so.0