X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Futmp-wtmp.c;h=46dfba336aaa7317ba9824cbc230b20e71e0be6f;hp=d7cda82d5a6dfc98669a7d89b9bf33aee0385a09;hb=36c32ba297a5296227902cef15730a0e55fec8e7;hpb=629c210d3f080854d2d90386f9da1423e53e114e diff --git a/src/utmp-wtmp.c b/src/utmp-wtmp.c index d7cda82d5..46dfba336 100644 --- a/src/utmp-wtmp.c +++ b/src/utmp-wtmp.c @@ -202,11 +202,11 @@ int utmp_put_runlevel(usec_t t, int runlevel, int previous) { previous = 0; } - - if (previous == runlevel) - return 0; } + if (previous == runlevel) + return 0; + init_entry(&store, t); store.ut_type = RUN_LVL; @@ -296,12 +296,14 @@ int utmp_wall(const char *message) { time_t t; if (!(hn = gethostname_malloc()) || - !(un = getlogname_malloc()) || - !(tty = getttyname_malloc())) { + !(un = getlogname_malloc())) { r = -ENOMEM; goto finish; } + if ((r = getttyname_malloc(&tty)) < 0) + goto finish; + time(&t); assert_se(ctime_r(&t, date)); delete_chars(date, "\n\r");