init_entry(&store, timestamp);
store.ut_type = BOOT_TIME;
- strncpy(store.ut_user, "reboot", sizeof(store.ut_type));
+ strncpy(store.ut_user, "reboot", sizeof(store.ut_user));
return write_entry_both(&store);
}
if (previous <= 0) {
/* Find the old runlevel automatically */
- if ((r = utmp_get_runlevel(&previous, NULL)) < 0)
- return r;
+ if ((r = utmp_get_runlevel(&previous, NULL)) < 0) {
+ if (r != -ESRCH)
+ return r;
+
+ previous = 0;
+ }
if (previous == runlevel)
return 0;