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)
commite555fc7adf14276ad16f22e4551821a10946d38d
treeea7c87e90460f520723b66dd028d5f207592f7fd
parent1c61a64901ca5b887afc158cb9a5de9ff8cad3df
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