Don't risk catching a signal while handling a signal for a dying child, as we

can then end up not properly clearing wtmp/utmp entries.

PR:		bin/37934
Submitted by:	Sandeep Kumar <skumar@juniper.net>
Reviewed by:	markm
MFC after:	2 weeks
This commit is contained in:
Juli Mallett 2002-05-27 08:10:24 +00:00
parent 6db5f8a79e
commit 2061e87111
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97341
3 changed files with 24 additions and 0 deletions

View File

@ -1317,8 +1317,16 @@ void
cleanup(int sig __unused)
{
char *p;
sigset_t mask;
p = line + sizeof(_PATH_DEV) - 1;
/*
* Block all signals before clearing the utmp entry. We don't want to
* be called again after calling logout() and then not add the wtmp
* entry because of not finding the corresponding entry in utmp.
*/
sigfillset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
if (logout(p))
logwtmp(p, "", "");
(void)chmod(line, 0666);

View File

@ -1317,8 +1317,16 @@ void
cleanup(int sig __unused)
{
char *p;
sigset_t mask;
p = line + sizeof(_PATH_DEV) - 1;
/*
* Block all signals before clearing the utmp entry. We don't want to
* be called again after calling logout() and then not add the wtmp
* entry because of not finding the corresponding entry in utmp.
*/
sigfillset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
if (logout(p))
logwtmp(p, "", "");
(void)chmod(line, 0666);

View File

@ -1170,8 +1170,16 @@ void
cleanup(int sig __unused)
{
char *p;
sigset_t mask;
p = line + sizeof(_PATH_DEV) - 1;
/*
* Block all signals before clearing the utmp entry. We don't want to
* be called again after calling logout() and then not add the wtmp
* entry because of not finding the corresponding entry in utmp.
*/
sigfillset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
if (logout(p))
logwtmp(p, "", "");
(void)chmod(line, 0666);