From: Ryan P. Kelly <rpkelly22@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: [PATCH] Prevent hanging on unreachable hosts on startup
Date: Wed, 4 Jan 2012 20:17:30 -0500
Message-ID: <20120105011730.GA26760@llserver.lakeliving.com> (raw)
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(-)
inline patch 1: src/bin/psql/startup.c (+2/-3 lines) download inline-1.patchdiff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.cindex 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: rpkelly22@gmail.com
Subject: Re: [PATCH] Prevent hanging on unreachable hosts on startup
In-Reply-To: <20120105011730.GA26760@llserver.lakeliving.com>
References: <20120105011730.GA26760@llserver.lakeliving.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox