~mdw
/
xtoys
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve signal handling. Fix options parsing to POSIX order only.
[xtoys]
/
xwait.c
diff --git
a/xwait.c
b/xwait.c
index
965b368
..
c74d2e2
100644
(file)
--- a/
xwait.c
+++ b/
xwait.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: xwait.c,v 1.
5 1998/11/30 22:36:53
mdw Exp $
+ * $Id: xwait.c,v 1.
7 1999/06/19 23:42:37
mdw Exp $
*
* Wait until prodded by another X client
*
*
* Wait until prodded by another X client
*
@@
-29,6
+29,12
@@
/*----- 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.5 1998/11/30 22:36:53 mdw
* Tidy up tabbing in help texts very slightly.
*
* Revision 1.5 1998/11/30 22:36:53 mdw
* Tidy up tabbing in help texts very slightly.
*
@@
-50,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>
@@
-62,8
+69,9
@@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include "mdwopt.h"
-#include "quis.h"
+#include <mLib/mdwopt.h>
+#include <mLib/quis.h>
+
#include "xwait.h"
/*----- Main code ---------------------------------------------------------*/
#include "xwait.h"
/*----- Main code ---------------------------------------------------------*/
@@
-72,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@ --- */
@@
-235,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 --- */