Use OsSignal in Popen/Pclose to avoid SysV signal() stupidity

This commit is contained in:
Alan Coopersmith 2008-11-05 18:25:57 -08:00
parent d63ea51013
commit c9051b684b

View File

@ -1393,7 +1393,7 @@ static struct pid {
int pid; int pid;
} *pidlist; } *pidlist;
void (*old_alarm)(int) = NULL; /* XXX horrible awful hack */ OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */
pointer pointer
Popen(char *command, char *type) Popen(char *command, char *type)
@ -1417,7 +1417,7 @@ Popen(char *command, char *type)
} }
/* Ignore the smart scheduler while this is going on */ /* Ignore the smart scheduler while this is going on */
old_alarm = signal(SIGALRM, SIG_IGN); old_alarm = OsSignal(SIGALRM, SIG_IGN);
if (old_alarm == SIG_ERR) { if (old_alarm == SIG_ERR) {
perror("signal"); perror("signal");
return NULL; return NULL;
@ -1428,7 +1428,7 @@ Popen(char *command, char *type)
close(pdes[0]); close(pdes[0]);
close(pdes[1]); close(pdes[1]);
xfree(cur); xfree(cur);
if (signal(SIGALRM, old_alarm) == SIG_ERR) if (OsSignal(SIGALRM, old_alarm) == SIG_ERR)
perror("signal"); perror("signal");
return NULL; return NULL;
case 0: /* child */ case 0: /* child */
@ -1605,7 +1605,7 @@ Pclose(pointer iop)
/* allow EINTR again */ /* allow EINTR again */
OsReleaseSignals (); OsReleaseSignals ();
if (old_alarm && signal(SIGALRM, old_alarm) == SIG_ERR) { if (old_alarm && OsSignal(SIGALRM, old_alarm) == SIG_ERR) {
perror("signal"); perror("signal");
return -1; return -1;
} }