Hello
sigmask macro is defined in win32.h like this:
```
#define sigmask(sig) ( 1 << ((sig)-1) )
```
And used in signal.c in this fashion:
```
for (i = 0; i < PG_SIGNAL_COUNT; i++)
{
if (exec_mask & sigmask(i))
{
```
Thus during first iteration we are doing `<< -1`. I think it's a bug.
Patch attached.
--
Best regards,
Aleksander Alekseev
http://eax.me/
diff --git a/src/backend/port/win32/signal.c b/src/backend/port/win32/signal.c
index 36c6ebd..3724aa3 100644
--- a/src/backend/port/win32/signal.c
+++ b/src/backend/port/win32/signal.c
@@ -115,14 +115,14 @@ pgwin32_dispatch_queued_signals(void)
for (i = 0; i < PG_SIGNAL_COUNT; i++)
{
- if (exec_mask & sigmask(i))
+ if (exec_mask & sigmask(i+1))
{
/* Execute this signal */
pqsigfunc sig = pg_signal_array[i];
if (sig == SIG_DFL)
sig = pg_signal_defaults[i];
- pg_signal_queue &= ~sigmask(i);
+ pg_signal_queue &= ~sigmask(i+1);
if (sig != SIG_ERR && sig != SIG_IGN && sig != SIG_DFL)
{
LeaveCriticalSection(&pg_signal_crit_sec);
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers