chiark / gitweb /
update-utmp: Don't error out on runlevel updates if utmp doesn't exist
authorColin Walters <walters@verbum.org>
Thu, 13 Sep 2012 14:51:30 +0000 (10:51 -0400)
committerLennart Poettering <lennart@poettering.net>
Thu, 13 Sep 2012 15:17:32 +0000 (17:17 +0200)
Other parts of the code handle utmp not existing, so let's be
consistent.  At the moment my GNOME-OSTree builds don't have utmp.

src/update-utmp/update-utmp.c

index fceeed8..67c5788 100644 (file)
@@ -301,8 +301,10 @@ static int on_runlevel(Context *c) {
 #endif
 
         if ((q = utmp_put_runlevel(runlevel, previous)) < 0) {
-                log_error("Failed to write utmp record: %s", strerror(-q));
-                r = q;
+                if (q != -ESRCH && q != -ENOENT) {
+                        log_error("Failed to write utmp record: %s", strerror(-q));
+                        r = q;
+                }
         }
 
         return r;