Skip to content
Snippets Groups Projects
Commit af331e25 authored by Tom Lane's avatar Tom Lane
Browse files

Ensure that we only create one ConsoleCtrlHandler per psql process,

so as to avoid performance issues and possible ultimate crash on long
psql scripts.  Per Merlin Moncure.
parent 081ed99b
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.109 2005/10/27 13:34:47 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.110 2005/11/04 18:35:40 tgl Exp $
*/
#include "postgres_fe.h"
#include "common.h"
......@@ -268,6 +268,7 @@ handle_sigint(SIGNAL_ARGS)
}
errno = save_errno; /* just in case the write changed it */
}
#else /* WIN32 */
static BOOL WINAPI
......@@ -313,8 +314,16 @@ setup_win32_locks(void)
void
setup_cancel_handler(void)
{
SetConsoleCtrlHandler(consoleHandler, TRUE);
static bool done = false;
/* only need one handler per process */
if (!done)
{
SetConsoleCtrlHandler(consoleHandler, TRUE);
done = true;
}
}
#endif /* WIN32 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment