X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fpidwait.c;h=ba9bae21bf996a84eb74b49642a72e04f9c48c15;hp=65c55b9269a928c95499246b682fc6035b83abf0;hb=1642d62841486ade88ec2c48dd581e3249c98c94;hpb=ced6090a330d3d83d0bce709f756aa3d7d65fea4 diff --git a/sbr/pidwait.c b/sbr/pidwait.c index 65c55b9..ba9bae2 100644 --- a/sbr/pidwait.c +++ b/sbr/pidwait.c @@ -10,46 +10,29 @@ #include #include #include - -#ifdef HAVE_SYS_WAIT_H -# include -#endif +#include int -pidwait (pid_t id, int sigsok) +pidwait(pid_t id, int sigsok) { pid_t pid; SIGNAL_HANDLER istat = NULL, qstat = NULL; - -#ifdef HAVE_UNION_WAIT - union wait status; -#else int status; -#endif if (sigsok == -1) { /* ignore a couple of signals */ - istat = SIGNAL (SIGINT, SIG_IGN); - qstat = SIGNAL (SIGQUIT, SIG_IGN); + istat = SIGNAL(SIGINT, SIG_IGN); + qstat = SIGNAL(SIGQUIT, SIG_IGN); } -#ifdef HAVE_WAITPID while ((pid = waitpid(id, &status, 0)) == -1 && errno == EINTR) ; -#else - while ((pid = wait(&status)) != -1 && pid != id) - continue; -#endif if (sigsok == -1) { /* reset the signal handlers */ - SIGNAL (SIGINT, istat); - SIGNAL (SIGQUIT, qstat); + SIGNAL(SIGINT, istat); + SIGNAL(SIGQUIT, qstat); } -#ifdef HAVE_UNION_WAIT - return (pid == -1 ? -1 : status.w_status); -#else return (pid == -1 ? -1 : status); -#endif }