Date: Wed, 14 Dec 2005 09:40:07 GMT From: Maxim Konovalov <maxim@macomnet.ru> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/90334: /bin/sh trap problem Message-ID: <200512140940.jBE9e7bW050762@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/90334; it has been noted by GNATS. From: Maxim Konovalov <maxim@macomnet.ru> To: Dmitriy Kirhlarov <dkirhlarov@oilspace.com> Cc: bug-followup@freebsd.org, kst@oilspace.com Subject: Re: bin/90334: /bin/sh trap problem Date: Wed, 14 Dec 2005 12:36:50 +0300 (MSK) [...] > 2/ By your co-worker, Konstantin Stepanenkov, break an endless loop if > we get ECHILD: > > Index: jobs.c > =================================================================== > RCS file: /home/ncvs/src/bin/sh/jobs.c,v > retrieving revision 1.69 > diff -u -r1.69 jobs.c > --- jobs.c 5 Sep 2005 17:57:19 -0000 1.69 > +++ jobs.c 13 Dec 2005 18:38:26 -0000 > @@ -929,6 +929,8 @@ > if (pid <= 0) > return -1; > } > + if (errno == ECHILD) > + job->state = 1; > if (pid <= 0) > return pid; > INTOFF; > %%% BDE has more elegant version of this patch: Index: sh/jobs.c =================================================================== RCS file: /home/ncvs/src/bin/sh/jobs.c,v retrieving revision 1.69 diff -u -r1.69 jobs.c --- sh/jobs.c 5 Sep 2005 17:57:19 -0000 1.69 +++ sh/jobs.c 14 Dec 2005 09:35:03 -0000 @@ -924,6 +924,8 @@ } while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) || (pid > 0 && WIFSTOPPED(status) && !iflag)); in_dowait--; + if (pid == -1 && errno == ECHILD && job != NULL) + job->state = JOBDONE; if (breakwaitcmd != 0) { breakwaitcmd = 0; if (pid <= 0) %%% I am going to commit it after some tests. -- Maxim Konovalov
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512140940.jBE9e7bW050762>