mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/port/sprompt.c,v 1.16 2006/03/05 15:59:10 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/port/sprompt.c,v 1.17 2006/06/14 16:49:03 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -32,7 +32,6 @@
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
bool prompt_state = false;
|
||||
extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
|
||||
|
||||
char *
|
||||
@ -57,8 +56,6 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
|
||||
if (!destination)
|
||||
return NULL;
|
||||
|
||||
prompt_state = true; /* disable SIGINT */
|
||||
|
||||
/*
|
||||
* Do not try to collapse these into one "w+" mode file. Doesn't work on
|
||||
* some platforms (eg, HPUX 10.20).
|
||||
@ -159,7 +156,5 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
|
||||
fclose(termout);
|
||||
}
|
||||
|
||||
prompt_state = false; /* SIGINT okay again */
|
||||
|
||||
return destination;
|
||||
}
|
||||
|
Reference in New Issue
Block a user