From da9212667c99f2f2121747c4715d067deb7c155b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 5 Jan 2015 15:37:58 +0100 Subject: libbb: code shrink by factoring out common update_utmp_DEAD_PROCESS function old new delta update_utmp_DEAD_PROCESS - 17 +17 telnetd_main 1685 1674 -11 mark_terminated 56 45 -11 handle_sigchld 74 63 -11 Signed-off-by: Denys Vlasenko --- networking/telnetd.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'networking/telnetd.c') diff --git a/networking/telnetd.c b/networking/telnetd.c index 9e7a84cce..6aee95871 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -462,15 +462,7 @@ static void handle_sigchld(int sig UNUSED_PARAM) while (ts) { if (ts->shell_pid == pid) { ts->shell_pid = -1; -// man utmp: -// When init(8) finds that a process has exited, it locates its utmp entry -// by ut_pid, sets ut_type to DEAD_PROCESS, and clears ut_user, ut_host -// and ut_time with null bytes. -// [same applies to other processes which maintain utmp entries, like telnetd] -// -// We do not bother actually clearing fields: -// it might be interesting to know who was logged in and from where - update_utmp(pid, DEAD_PROCESS, /*tty_name:*/ NULL, /*username:*/ NULL, /*hostname:*/ NULL); + update_utmp_DEAD_PROCESS(pid); break; } ts = ts->next; @@ -739,7 +731,7 @@ int telnetd_main(int argc UNUSED_PARAM, char **argv) continue; kill_session: if (ts->shell_pid > 0) - update_utmp(ts->shell_pid, DEAD_PROCESS, /*tty_name:*/ NULL, /*username:*/ NULL, /*hostname:*/ NULL); + update_utmp_DEAD_PROCESS(ts->shell_pid); free_session(ts); ts = next; } -- cgit v1.2.3