1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

utmp: if we don't have a previous runleve, just store 0

This commit is contained in:
Lennart Poettering 2010-04-24 00:31:21 +02:00
parent 858a9b0a99
commit d7fc909db3

View File

@ -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;