summaryrefslogtreecommitdiffstats
path: root/libexec/telnetd
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-05-27 08:10:24 +0000
committerjmallett <jmallett@FreeBSD.org>2002-05-27 08:10:24 +0000
commitafc38d0730cc1ba87365292cf6507420b200ea4e (patch)
treebd91e7432994f354f0d2f4a03c43978d771aecec /libexec/telnetd
parent36a7d4b91404b3e0174fbde050a5e26230c971d7 (diff)
downloadFreeBSD-src-afc38d0730cc1ba87365292cf6507420b200ea4e.zip
FreeBSD-src-afc38d0730cc1ba87365292cf6507420b200ea4e.tar.gz
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
Diffstat (limited to 'libexec/telnetd')
-rw-r--r--libexec/telnetd/sys_term.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index 089b0db..17686b3 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -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);
OpenPOWER on IntegriCloud