chiark
/
gitweb
/
~mdw
/
xtoys
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b907fbe
)
Block SIGCHLD around the `fork' call to prevent a race.
author
mdw
<mdw>
Wed, 5 May 1999 18:55:18 +0000
(18:55 +0000)
committer
mdw
<mdw>
Wed, 5 May 1999 18:55:18 +0000
(18:55 +0000)
xcatch.c
patch
|
blob
|
blame
|
history
diff --git
a/xcatch.c
b/xcatch.c
index 43d3b024959f45bef212db1fd0fdc001eca5d559..a341cb14b402b4fb37bf37e8eb8004788a7c6a9e 100644
(file)
--- a/
xcatch.c
+++ b/
xcatch.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: xcatch.c,v 1.
4 1999/03/24 22:23:57
mdw Exp $
+ * $Id: xcatch.c,v 1.
5 1999/05/05 18:55:18
mdw Exp $
*
* Catch input and trap it in an X window
*
*
* Catch input and trap it in an X window
*
@@
-29,6
+29,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: xcatch.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: xcatch.c,v $
+ * Revision 1.5 1999/05/05 18:55:18 mdw
+ * Block SIGCHLD around the `fork' call to prevent a race.
+ *
* Revision 1.4 1999/03/24 22:23:57 mdw
* Improve display for large files. Keep newly added material in view if
* scrolled to bottom of window.
* Revision 1.4 1999/03/24 22:23:57 mdw
* Improve display for large files. Keep newly added material in view if
* scrolled to bottom of window.
@@
-327,6
+330,7
@@
int main(int argc, char *argv[])
else {
int pfd[2];
struct sigaction sa;
else {
int pfd[2];
struct sigaction sa;
+ sigset_t newmask, oldmask;
/* --- Set up a signal handler --- */
/* --- Set up a signal handler --- */
@@
-339,6
+343,11
@@
int main(int argc, char *argv[])
if (pipe(pfd))
die(1, "couldn't open pipe: %s", strerror(errno));
if (pipe(pfd))
die(1, "couldn't open pipe: %s", strerror(errno));
+
+ sigemptyset(&newmask);
+ sigaddset(&newmask, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &newmask, &oldmask);
+
kid = fork();
if (kid < 0)
die(1, "couldn't fork: %s", strerror(errno));
kid = fork();
if (kid < 0)
die(1, "couldn't fork: %s", strerror(errno));
@@
-360,6
+369,8
@@
int main(int argc, char *argv[])
write(STDERR_FILENO, d.buf, d.len);
_exit(127);
}
write(STDERR_FILENO, d.buf, d.len);
_exit(127);
}
+
+ sigprocmask(SIG_SETMASK, &oldmask, 0);
fd = pfd[0];
close(pfd[1]);
}
fd = pfd[0];
close(pfd[1]);
}