Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 0E17A189E6CD for ; Wed, 4 Jan 2012 21:17:53 -0400 (AST) Received: from mail-vw0-f46.google.com ([209.85.212.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ribxo-0006Vu-BL for pgsql-bugs@postgresql.org; Thu, 05 Jan 2012 01:17:52 +0000 Received: by vbbfc26 with SMTP id fc26so28458vbb.19 for ; Wed, 04 Jan 2012 17:17:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=ezkadxnqILzP8LRboGAMFIX4A87jFSjlW/SsXZBroW4=; b=tBleT+I/CR2PGEvEXzoFT0Lx3S2wNuODaTQI5LYRco+RMNd7V9e2bf85hf/KaxNv7y f+cUT6F7qOQ7tqq2tnEeSYe6TnrAufH26VWnAgIvJkkZ4pGKCe2FLvsPN7qTSk3NWb0Z koWLNyA4qvzLN4r2wvYbXjIDM8teGoLoZGsLU= Received: by 10.52.20.165 with SMTP id o5mr28282865vde.79.1325726259669; Wed, 04 Jan 2012 17:17:39 -0800 (PST) Received: from llserver.lakeliving.com (ool-18bbd2c6.static.optonline.net. [24.187.210.198]) by mx.google.com with ESMTPS id iv10sm10197573vdb.18.2012.01.04.17.17.38 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 04 Jan 2012 17:17:38 -0800 (PST) Date: Wed, 4 Jan 2012 20:17:30 -0500 From: "Ryan P. Kelly" To: pgsql-bugs@postgresql.org Subject: [PATCH] Prevent hanging on unreachable hosts on startup Message-ID: <20120105011730.GA26760@llserver.lakeliving.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201201/31 X-Sequence-Number: 32098 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