]> granicus.if.org Git - postgresql/commitdiff
That's just the lovely way windows handles a "segfault". Gotta be really
authorBruce Momjian <bruce@momjian.us>
Mon, 1 Nov 2004 19:21:50 +0000 (19:21 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 1 Nov 2004 19:21:50 +0000 (19:21 +0000)
interesting for MS to catch all those dumps...

Anyway. Oops. Seems I ran my regression tests with the old psql, and
just managed to update the backend, when I tested that patch. Turns out
there are codepaths where we'd access the Critical Section before it was
initialized. Attached patch breaks the initializeation off to a separate
part and adds that one to a much earlier position in the program.

Magnus Hagander

src/bin/psql/common.c
src/bin/psql/common.h
src/bin/psql/startup.c

index 0089d5d2c81a53fe31b066995ff0f3561e26affc..44278aa9265540f6807505910d189010f5b7ad34 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2004, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.93 2004/10/30 23:10:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.94 2004/11/01 19:21:50 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "common.h"
@@ -307,9 +307,14 @@ consoleHandler(DWORD dwCtrlType)
 }
 
 void
-setup_cancel_handler(void)
+setup_win32_locks(void)
 {
        InitializeCriticalSection(&cancelConnLock);
+}
+
+void
+setup_cancel_handler(void)
+{
        SetConsoleCtrlHandler(consoleHandler, TRUE);
 }
 
index cf917cedca995bc07d8c0fb89c5e97acb3bd2967..1f2de0a4f0c3e8202a7e4c133d68236912f5f10f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2004, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.40 2004/10/30 23:10:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.41 2004/11/01 19:21:50 momjian Exp $
  */
 #ifndef COMMON_H
 #define COMMON_H
@@ -49,6 +49,7 @@ extern void ResetCancelConn(void);
 #ifndef WIN32
 extern void handle_sigint(SIGNAL_ARGS);
 #else
+extern void setup_win32_locks(void);
 extern void setup_cancel_handler(void);
 #endif
 
index 87f9200d7cdbe2757f49a3d857331f44783505cc..d7ef12a315ac533b6b3652fb0336c4a25ea10c88 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2004, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.104 2004/10/16 03:10:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.105 2004/11/01 19:21:50 momjian Exp $
  */
 #include "postgres_fe.h"
 
@@ -121,6 +121,7 @@ main(int argc, char *argv[])
 
 #ifdef WIN32
        setvbuf(stderr, NULL, _IONBF, 0);
+       setup_win32_locks();
 #endif
        pset.cur_cmd_source = stdin;
        pset.cur_cmd_interactive = false;