X-Git-Url: https://git.distorted.org.uk/~mdw/xtoys/blobdiff_plain/d6130abd9c338ba8b63bfc4600adf1fa09c02fe8..d72bdcdbbe512494f64102d18879a08163f231a3:/xwait.c diff --git a/xwait.c b/xwait.c index 965b368..c74d2e2 100644 --- a/xwait.c +++ b/xwait.c @@ -1,6 +1,6 @@ /* -*-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 * @@ -29,6 +29,12 @@ /*----- 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. * @@ -50,6 +56,7 @@ /*----- Header files ------------------------------------------------------*/ +#include #include #include #include @@ -62,8 +69,9 @@ #include #include -#include "mdwopt.h" -#include "quis.h" +#include +#include + #include "xwait.h" /*----- Main code ---------------------------------------------------------*/ @@ -72,8 +80,10 @@ static void sigchld(int sig) { + int e = errno; while (waitpid(-1, 0, WNOHANG) > 0) ; + errno = e; } /* --- @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_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 --- */