=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/calendar/calendar.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- src/usr.bin/calendar/calendar.c 2011/09/12 21:23:00 1.27 +++ src/usr.bin/calendar/calendar.c 2012/01/31 08:29:25 1.28 @@ -1,4 +1,4 @@ -/* $OpenBSD: calendar.c,v 1.27 2011/09/12 21:23:00 jmc Exp $ */ +/* $OpenBSD: calendar.c,v 1.28 2012/01/31 08:29:25 otto Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -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)