From 5491233f5245c464be2286ad894448b21ef757db Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 18 Dec 2000 17:33:42 +0000 Subject: Ensure that 'errno' is saved and restored by all signal handlers that might change it. Experimentation shows that the signal handler call mechanism does not save/restore errno for you, at least not on Linux or HPUX, so this is definitely a real risk. --- src/backend/tcop/postgres.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 706b5d1fbf1..02c1459052d 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.195 2000/12/18 00:44:47 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.196 2000/12/18 17:33:41 tgl Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -984,8 +984,11 @@ FloatExceptionHandler(SIGNAL_ARGS) static void QueryCancelHandler(SIGNAL_ARGS) { + int save_errno = errno; + QueryCancel = true; LockWaitCancel(); + errno = save_errno; } void @@ -1646,7 +1649,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface "); - puts("$Revision: 1.195 $ $Date: 2000/12/18 00:44:47 $\n"); + puts("$Revision: 1.196 $ $Date: 2000/12/18 17:33:41 $\n"); } /* -- cgit v1.2.3