summaryrefslogtreecommitdiff
path: root/utmp-wtmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'utmp-wtmp.c')
-rw-r--r--utmp-wtmp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/utmp-wtmp.c b/utmp-wtmp.c
index 1650d10eba..0cc9ceca84 100644
--- a/utmp-wtmp.c
+++ b/utmp-wtmp.c
@@ -193,8 +193,12 @@ int utmp_put_runlevel(usec_t timestamp, int runlevel, int previous) {
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;