aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
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