diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-06-14 16:49:03 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-06-14 16:49:03 +0000 |
commit | f3164c020028de70e4cd991ccbd3d696c9060709 (patch) | |
tree | 02b6ad16c4498a1d8609e9237b769e57eb1a6aaf /src/bin/psql/variables.c | |
parent | ace93353eadf1316364bcb76f52952c413779083 (diff) | |
download | postgresql-f3164c020028de70e4cd991ccbd3d696c9060709.tar.gz postgresql-f3164c020028de70e4cd991ccbd3d696c9060709.zip |
Clean up psql's control-C handling to avoid longjmp'ing out of random
places --- that risks corrupting data structures, losing sync with the
backend, etc. We now longjmp only from calls to readline, fgets, and
fread, which we assume are coded to protect themselves against interrupts
at undesirable times. This requires adding explicit tests for
cancel_pressed in long-running loops, but on the whole it's far cleaner.
Martijn van Oosterhout and Tom Lane.
Diffstat (limited to 'src/bin/psql/variables.c')
-rw-r--r-- | src/bin/psql/variables.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bin/psql/variables.c b/src/bin/psql/variables.c index da13cb78d71..26b9f8b925d 100644 --- a/src/bin/psql/variables.c +++ b/src/bin/psql/variables.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2006, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/variables.c,v 1.23 2006/03/05 15:58:52 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/variables.c,v 1.24 2006/06/14 16:49:03 tgl Exp $ */ #include "postgres_fe.h" #include "common.h" @@ -127,7 +127,11 @@ PrintVariables(VariableSpace space) struct _variable *ptr; for (ptr = space->next; ptr; ptr = ptr->next) + { printf("%s = '%s'\n", ptr->name, ptr->value); + if (cancel_pressed) + break; + } } bool |