On Fri, Jan 20, 2012 at 10:48:54AM +0100, Otto Moerbeek wrote: > On Fri, Jan 20, 2012 at 10:38:35AM +0100, Michael Meskes wrote: > > > On Thu, Jan 19, 2012 at 09:41:08PM +0100, Otto Moerbeek wrote: > > > > With a hint from Paul Jantzen I did test this a bit further. There's > > > > > > That is, Paul Janzen, sorry about that. > > > > > > > code to avoid having a child runing too long. If you have 20s > > > > patience, you'll see this: > > > > > > > > calendar: uid 1000 did not finish in time > > > > After reading Paul's explanation I found my mistake. The fix works great for > > calendar -a but not if you call calendar directly on the named pipe. Of > > course > > the latter is not really a problem, so I'm going to remove that patch from > > our > > sources. > > > > Thanks for the explanations. > > > > Any ideas about the other patches? > > I don't think I have a chance to look at them the coming time. > Any other volunteer here? > > -Otto
Buete here is Paul's diff. It makes sure all descendants are killed, insted of only the direct child. OK? -Otto Index: calendar.c =================================================================== RCS file: /cvs/src/usr.bin/calendar/calendar.c,v retrieving revision 1.27 diff -u calendar.c --- calendar.c 12 Sep 2011 21:23:00 -0000 1.27 +++ calendar.c 19 Jan 2012 18:29:22 -0000 @@ -169,6 +169,7 @@ warn("fork"); continue; case 0: /* child */ + (void)setpgid(getpid(), getpid()); (void)setlocale(LC_ALL, ""); if (setusercontext(NULL, pw, pw->pw_uid, LOGIN_SETALL ^ LOGIN_SETLOGIN)) @@ -214,7 +215,10 @@ /* It doesn't _really_ matter if the kill fails, e.g. * if there's only a zombie now. */ - (void)kill(kid, SIGTERM); + if (getpgid(kid) != getpgrp()) + (void)killpg(getpgid(kid), SIGTERM); + else + (void)kill(kid, SIGTERM); warnx("uid %u did not finish in time", pw->pw_uid); } if (time(NULL) - t >= SECSPERDAY)