Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7fad5ff

Browse files
committed
That's just the lovely way windows handles a "segfault". Gotta be really
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
1 parent 9c3d654 commit 7fad5ff

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/bin/psql/common.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.93 2004/10/30 23:10:50 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.94 2004/11/01 19:21:50 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "common.h"
@@ -307,9 +307,14 @@ consoleHandler(DWORD dwCtrlType)
307307
}
308308

309309
void
310-
setup_cancel_handler(void)
310+
setup_win32_locks(void)
311311
{
312312
InitializeCriticalSection(&cancelConnLock);
313+
}
314+
315+
void
316+
setup_cancel_handler(void)
317+
{
313318
SetConsoleCtrlHandler(consoleHandler, TRUE);
314319
}
315320

src/bin/psql/common.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.40 2004/10/30 23:10:50 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.41 2004/11/01 19:21:50 momjian Exp $
77
*/
88
#ifndef COMMON_H
99
#define COMMON_H
@@ -49,6 +49,7 @@ extern void ResetCancelConn(void);
4949
#ifndef WIN32
5050
extern void handle_sigint(SIGNAL_ARGS);
5151
#else
52+
extern void setup_win32_locks(void);
5253
extern void setup_cancel_handler(void);
5354
#endif
5455

src/bin/psql/startup.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.104 2004/10/16 03:10:16 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.105 2004/11/01 19:21:50 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -121,6 +121,7 @@ main(int argc, char *argv[])
121121

122122
#ifdef WIN32
123123
setvbuf(stderr, NULL, _IONBF, 0);
124+
setup_win32_locks();
124125
#endif
125126
pset.cur_cmd_source = stdin;
126127
pset.cur_cmd_interactive = false;

0 commit comments

Comments
 (0)