aboutsummaryrefslogtreecommitdiff
path: root/networking/telnetd.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-01-05 15:37:58 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2015-01-05 15:37:58 +0100
commitda9212667c99f2f2121747c4715d067deb7c155b (patch)
tree66a670e6d78ca899a454a42228abbbc2740fad0d /networking/telnetd.c
parent08b90a9d10f2f712c6e16c118328d85930762b92 (diff)
downloadbusybox-w32-da9212667c99f2f2121747c4715d067deb7c155b.tar.gz
busybox-w32-da9212667c99f2f2121747c4715d067deb7c155b.tar.bz2
busybox-w32-da9212667c99f2f2121747c4715d067deb7c155b.zip
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 <vda.linux@googlemail.com>
Diffstat (limited to 'networking/telnetd.c')
-rw-r--r--networking/telnetd.c12
1 files changed, 2 insertions, 10 deletions
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)
462 while (ts) { 462 while (ts) {
463 if (ts->shell_pid == pid) { 463 if (ts->shell_pid == pid) {
464 ts->shell_pid = -1; 464 ts->shell_pid = -1;
465// man utmp: 465 update_utmp_DEAD_PROCESS(pid);
466// When init(8) finds that a process has exited, it locates its utmp entry
467// by ut_pid, sets ut_type to DEAD_PROCESS, and clears ut_user, ut_host
468// and ut_time with null bytes.
469// [same applies to other processes which maintain utmp entries, like telnetd]
470//
471// We do not bother actually clearing fields:
472// it might be interesting to know who was logged in and from where
473 update_utmp(pid, DEAD_PROCESS, /*tty_name:*/ NULL, /*username:*/ NULL, /*hostname:*/ NULL);
474 break; 466 break;
475 } 467 }
476 ts = ts->next; 468 ts = ts->next;
@@ -739,7 +731,7 @@ int telnetd_main(int argc UNUSED_PARAM, char **argv)
739 continue; 731 continue;
740 kill_session: 732 kill_session:
741 if (ts->shell_pid > 0) 733 if (ts->shell_pid > 0)
742 update_utmp(ts->shell_pid, DEAD_PROCESS, /*tty_name:*/ NULL, /*username:*/ NULL, /*hostname:*/ NULL); 734 update_utmp_DEAD_PROCESS(ts->shell_pid);
743 free_session(ts); 735 free_session(ts);
744 ts = next; 736 ts = next;
745 } 737 }