]> err.no Git - util-linux/commitdiff
login: use xalloc lib
authorDavidlohr Bueso <dave@gnu.org>
Mon, 29 Nov 2010 12:27:11 +0000 (09:27 -0300)
committerKarel Zak <kzak@redhat.com>
Tue, 30 Nov 2010 12:18:18 +0000 (13:18 +0100)
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
login-utils/login.c

index 68eb84bc1d88b32d4e3a6f1e914e6ccfce864678..1802d3a20181929a1b4163b62729bb4bbeb09738 100644 (file)
 #include "login.h"
 #include "strutils.h"
 #include "nls.h"
-
+#include "xalloc.h"
 
 #ifdef HAVE_SECURITY_PAM_MISC_H
 #  include <security/pam_appl.h>
@@ -1240,12 +1240,7 @@ Michael Riepe <michael@stud.uni-hannover.de>
 
     /* if the shell field has a space: treat it like a shell script */
     if (strchr(pwd->pw_shell, ' ')) {
-       buff = malloc(strlen(pwd->pw_shell) + 6);
-
-       if (!buff) {
-           fprintf(stderr, _("login: no memory for shell script.\n"));
-           exit(0);
-       }
+       buff = xmalloc(strlen(pwd->pw_shell) + 6);
 
        strcpy(buff, "exec ");
        strcat(buff, pwd->pw_shell);