Clean up psql's control-C handling to avoid longjmp'ing out of random
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 14 Jun 2006 16:49:03 +0000 (16:49 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 14 Jun 2006 16:49:03 +0000 (16:49 +0000)
commitf3164c020028de70e4cd991ccbd3d696c9060709
tree02b6ad16c4498a1d8609e9237b769e57eb1a6aaf
parentace93353eadf1316364bcb76f52952c413779083
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.
12 files changed:
src/bin/psql/common.c
src/bin/psql/common.h
src/bin/psql/copy.c
src/bin/psql/describe.c
src/bin/psql/input.c
src/bin/psql/large_obj.c
src/bin/psql/mainloop.c
src/bin/psql/mainloop.h
src/bin/psql/print.c
src/bin/psql/startup.c
src/bin/psql/variables.c
src/port/sprompt.c