[PATCH] Prevent hanging on unreachable hosts on startup

From: "Ryan P(dot) Kelly" <rpkelly22(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: [PATCH] Prevent hanging on unreachable hosts on startup
Date: 2012-01-05 01:17:30
Message-ID: 20120105011730.GA26760@llserver.lakeliving.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-01-05 02:36:57 Re: [PATCH] Prevent hanging on unreachable hosts on startup
Previous Message Tom Lane 2012-01-04 23:37:32 Re: BUG #6379: SQL Function Causes Back-end Crash