diff options
author | Davidlohr Bueso | 2010-11-29 13:27:18 +0100 |
---|---|---|
committer | Karel Zak | 2010-11-30 13:18:18 +0100 |
commit | eecb3c83ce12de156a03e20892e553f660cef1bb (patch) | |
tree | e807257650da851ef07ee9ccdcf60c743ee9dd7b /login-utils/last.c | |
parent | login: use xalloc lib (diff) | |
download | kernel-qcow2-util-linux-eecb3c83ce12de156a03e20892e553f660cef1bb.tar.gz kernel-qcow2-util-linux-eecb3c83ce12de156a03e20892e553f660cef1bb.tar.xz kernel-qcow2-util-linux-eecb3c83ce12de156a03e20892e553f660cef1bb.zip |
last: use xalloc lib
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r-- | login-utils/last.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/login-utils/last.c b/login-utils/last.c index 564e05ca9..293a0fd62 100644 --- a/login-utils/last.c +++ b/login-utils/last.c @@ -49,6 +49,7 @@ #include "pathnames.h" #include "nls.h" +#include "xalloc.h" #define SECDAY (24*60*60) /* seconds in a day */ #define NO 0 /* false/no */ @@ -376,10 +377,7 @@ static void addarg(int type, char *arg) { register ARG *cur; - if (!(cur = (ARG *)malloc((unsigned int)sizeof(ARG)))) { - fputs(_("last: malloc failure.\n"), stderr); - exit(1); - } + cur = xmalloc(sizeof(ARG)); cur->next = arglist; cur->type = type; cur->name = arg; @@ -394,10 +392,7 @@ TTY * addtty(char *ttyname) { register TTY *cur; - if (!(cur = (TTY *)malloc((unsigned int)sizeof(TTY)))) { - fputs(_("last: malloc failure.\n"), stderr); - exit(1); - } + cur = xmalloc(sizeof(TTY)); cur->next = ttylist; cur->logout = currentout; memcpy(cur->tty, ttyname, LMAX); @@ -445,10 +440,7 @@ ttyconv(char *arg) { */ if (strlen(arg) == 2) { /* either 6 for "ttyxx" or 8 for "console" */ - if (!(mval = malloc((unsigned int)8))) { - fputs(_("last: malloc failure.\n"), stderr); - exit(1); - } + mval = xmalloc(8); if (!strcmp(arg, "co")) (void)strcpy(mval, "console"); else { |