From: Lennart Poettering Date: Fri, 23 Apr 2010 22:31:21 +0000 (+0200) Subject: utmp: if we don't have a previous runleve, just store 0 X-Git-Tag: 0.git+20100605+dfd8ee-1~61 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7fc909db3346b58a0ecce9c18d5ae68ffe7cb8b;p=systemd utmp: if we don't have a previous runleve, just store 0 --- diff --git a/utmp-wtmp.c b/utmp-wtmp.c index 1650d10e..0cc9ceca 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;