X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fupdate-utmp%2Fupdate-utmp.c;h=202aa987675b459b1b960b17f0e666c6f591ca4f;hp=fceeed8b446873281b87080a7a70a9a3ec89c95c;hb=cac914e643a50c72893c5478f6886e0978f8fa18;hpb=436dddeda6d212ffe2cc2ced4d84ce475137eddf diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c index fceeed8b4..202aa9876 100644 --- a/src/update-utmp/update-utmp.c +++ b/src/update-utmp/update-utmp.c @@ -48,7 +48,7 @@ typedef struct Context { static usec_t get_startup_time(Context *c) { const char *interface = "org.freedesktop.systemd1.Manager", - *property = "StartupTimestamp"; + *property = "UserspaceTimestamp"; usec_t t = 0; DBusMessage *reply = NULL; @@ -104,7 +104,7 @@ static int get_current_runlevel(Context *c) { { '3', SPECIAL_RUNLEVEL3_TARGET }, { '4', SPECIAL_RUNLEVEL4_TARGET }, { '2', SPECIAL_RUNLEVEL2_TARGET }, - { 'S', SPECIAL_RESCUE_TARGET }, + { '1', SPECIAL_RESCUE_TARGET }, }; const char *interface = "org.freedesktop.systemd1.Unit", @@ -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; @@ -311,11 +313,10 @@ static int on_runlevel(Context *c) { int main(int argc, char *argv[]) { int r; DBusError error; - Context c; + Context c = {}; dbus_error_init(&error); - zero(c); #ifdef HAVE_AUDIT c.audit_fd = -1; #endif