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:
e34817d
)
Improve signal handling.
author
mdw
<mdw>
Sat, 19 Jun 1999 23:42:37 +0000
(23:42 +0000)
committer
mdw
<mdw>
Sat, 19 Jun 1999 23:42:37 +0000
(23:42 +0000)
xwait.c
patch
|
blob
|
blame
|
history
diff --git
a/xwait.c
b/xwait.c
index d18fa3692d1892cd54f3bc3bba30759b72cdb677..c74d2e2765263818972558862f28721bf9a1f733 100644
(file)
--- a/
xwait.c
+++ b/
xwait.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: xwait.c,v 1.
6 1998/12/11 09:50:0
7 mdw Exp $
+ * $Id: xwait.c,v 1.
7 1999/06/19 23:42:3
7 mdw Exp $
*
* Wait until prodded by another X client
*
*
* Wait until prodded by another X client
*
@@
-29,6
+29,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: xwait.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: xwait.c,v $
+ * Revision 1.7 1999/06/19 23:42:37 mdw
+ * Improve signal handling.
+ *
* Revision 1.6 1998/12/11 09:50:07 mdw
* Minor modifications to work with mLib and mgLib.
*
* Revision 1.6 1998/12/11 09:50:07 mdw
* Minor modifications to work with mLib and mgLib.
*
@@
-53,6
+56,7
@@
/*----- Header files ------------------------------------------------------*/
/*----- Header files ------------------------------------------------------*/
+#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@
-76,8
+80,10
@@
static void sigchld(int sig)
{
static void sigchld(int sig)
{
+ int e = errno;
while (waitpid(-1, 0, WNOHANG) > 0)
;
while (waitpid(-1, 0, WNOHANG) > 0)
;
+ errno = e;
}
/* --- @main@ --- */
}
/* --- @main@ --- */
@@
-239,7
+245,10
@@
int main(int argc, char *argv[])
sa.sa_handler = sigchld;
sigemptyset(&sa.sa_mask);
sigaddset(&sa.sa_mask, SIGCHLD);
sa.sa_handler = sigchld;
sigemptyset(&sa.sa_mask);
sigaddset(&sa.sa_mask, SIGCHLD);
- sa.sa_flags = 0;
+ sa.sa_flags = SA_NOCLDSTOP;
+#ifdef SA_RESTART
+ sa.sa_flags |= SA_RESTART;
+#endif
sigaction(SIGCHLD, &sa, 0);
/* --- Now reap any which have been waiting around so far --- */
sigaction(SIGCHLD, &sa, 0);
/* --- Now reap any which have been waiting around so far --- */