aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-04-05 22:10:38 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-04-05 22:10:38 +0200
commit3a41611bc5ddeda6044e1f1e2956174b25389ce0 (patch)
treeadfc8a982cf321cc859900a28e9e92c82d43caea /init
parent37f5bef63c0db4892d8ffa3c38a04c7998e10f83 (diff)
downloadbusybox-w32-3a41611bc5ddeda6044e1f1e2956174b25389ce0.tar.gz
busybox-w32-3a41611bc5ddeda6044e1f1e2956174b25389ce0.tar.bz2
busybox-w32-3a41611bc5ddeda6044e1f1e2956174b25389ce0.zip
telnetd: write LOGIN/DEAD_PROCESS utmp records. Closes bug 1363
function old new delta write_new_utmp - 253 +253 skip_dev_pfx - 30 +30 handle_sigchld 42 72 +30 telnetd_main 1650 1673 +23 make_new_session 415 438 +23 ... login_main 1140 1148 +8 update_utmp 337 313 -24 write_wtmp 220 154 -66 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 11/6 up/down: 406/-115) Total: ~291 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'init')
-rw-r--r--init/halt.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/init/halt.c b/init/halt.c
index a3459ee48..f1bb2c4a8 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -18,17 +18,18 @@ static void write_wtmp(void)
18{ 18{
19 struct utmp utmp; 19 struct utmp utmp;
20 struct utsname uts; 20 struct utsname uts;
21 if (access(bb_path_wtmp_file, R_OK|W_OK) == -1) { 21 /* "man utmp" says wtmp file should *not* be created automagically */
22 /*if (access(bb_path_wtmp_file, R_OK|W_OK) == -1) {
22 close(creat(bb_path_wtmp_file, 0664)); 23 close(creat(bb_path_wtmp_file, 0664));
23 } 24 }*/
24 memset(&utmp, 0, sizeof(utmp)); 25 memset(&utmp, 0, sizeof(utmp));
25 utmp.ut_tv.tv_sec = time(NULL); 26 utmp.ut_tv.tv_sec = time(NULL);
26 safe_strncpy(utmp.ut_user, "shutdown", UT_NAMESIZE); 27 strcpy(utmp.ut_user, "shutdown"); /* it is wide enough */
27 utmp.ut_type = RUN_LVL; 28 utmp.ut_type = RUN_LVL;
28 safe_strncpy(utmp.ut_id, "~~", sizeof(utmp.ut_id)); 29 utmp.ut_id[0] = '~'; utmp.ut_id[1] = '~'; /* = strcpy(utmp.ut_id, "~~"); */
29 safe_strncpy(utmp.ut_line, "~~", UT_LINESIZE); 30 utmp.ut_line[0] = '~'; utmp.ut_line[1] = '~'; /* = strcpy(utmp.ut_line, "~~"); */
30 if (uname(&uts) == 0) 31 uname(&uts);
31 safe_strncpy(utmp.ut_host, uts.release, sizeof(utmp.ut_host)); 32 safe_strncpy(utmp.ut_host, uts.release, sizeof(utmp.ut_host));
32 updwtmp(bb_path_wtmp_file, &utmp); 33 updwtmp(bb_path_wtmp_file, &utmp);
33} 34}
34#else 35#else