1 From c9051b684b524549eab6d5b88ee3e195a6f6fbe8 Mon Sep 17 00:00:00 2001 |
|
2 From: Alan Coopersmith <[email protected]> |
|
3 Date: Wed, 5 Nov 2008 18:25:57 -0800 |
|
4 Subject: [PATCH] Use OsSignal in Popen/Pclose to avoid SysV signal() stupidity |
|
5 --- |
|
6 os/utils.c | 8 ++++---- |
|
7 1 files changed, 4 insertions(+), 4 deletions(-) |
|
8 |
|
9 diff --git a/os/utils.c b/os/utils.c |
|
10 index f0bb717..b100949 100644 |
|
11 --- a/os/utils.c |
|
12 +++ b/os/utils.c |
|
13 @@ -1393,7 +1393,7 @@ static struct pid { |
|
14 int pid; |
|
15 } *pidlist; |
|
16 |
|
17 -void (*old_alarm)(int) = NULL; /* XXX horrible awful hack */ |
|
18 +OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */ |
|
19 |
|
20 pointer |
|
21 Popen(char *command, char *type) |
|
22 @@ -1417,7 +1417,7 @@ Popen(char *command, char *type) |
|
23 } |
|
24 |
|
25 /* Ignore the smart scheduler while this is going on */ |
|
26 - old_alarm = signal(SIGALRM, SIG_IGN); |
|
27 + old_alarm = OsSignal(SIGALRM, SIG_IGN); |
|
28 if (old_alarm == SIG_ERR) { |
|
29 perror("signal"); |
|
30 return NULL; |
|
31 @@ -1428,7 +1428,7 @@ Popen(char *command, char *type) |
|
32 close(pdes[0]); |
|
33 close(pdes[1]); |
|
34 xfree(cur); |
|
35 - if (signal(SIGALRM, old_alarm) == SIG_ERR) |
|
36 + if (OsSignal(SIGALRM, old_alarm) == SIG_ERR) |
|
37 perror("signal"); |
|
38 return NULL; |
|
39 case 0: /* child */ |
|
40 @@ -1605,7 +1605,7 @@ #endif |
|
41 /* allow EINTR again */ |
|
42 OsReleaseSignals (); |
|
43 |
|
44 - if (old_alarm && signal(SIGALRM, old_alarm) == SIG_ERR) { |
|
45 + if (old_alarm && OsSignal(SIGALRM, old_alarm) == SIG_ERR) { |
|
46 perror("signal"); |
|
47 return -1; |
|
48 } |
|
49 -- |
|
50 1.4.1 |
|
51 |
|