X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Futmp-wtmp.c;fp=src%2Futmp-wtmp.c;h=45da79c681c8e3d92bf1abf2db75630593462ae6;hb=8c6db8336536916d0476ff8233e0abf40a2f6aab;hp=d7cda82d5a6dfc98669a7d89b9bf33aee0385a09;hpb=96551bae6107936a4576b9b4b391abbc9963bdfe;p=elogind.git diff --git a/src/utmp-wtmp.c b/src/utmp-wtmp.c index d7cda82d5..45da79c68 100644 --- a/src/utmp-wtmp.c +++ b/src/utmp-wtmp.c @@ -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");