]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sulogin: parse timeout more carefully
authorKarel Zak <kzak@redhat.com>
Mon, 12 Mar 2012 11:43:53 +0000 (12:43 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 12 Mar 2012 11:43:53 +0000 (12:43 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/Makefile.am
login-utils/sulogin.c

index 6d5f4e97bf7cd08c668990a6c08d0ab503f172b4..fbc73ece246370405933d77b828a7c62e6794dbb 100644 (file)
@@ -50,6 +50,9 @@ login_SOURCES = \
        logindefs.c \
        logindefs.h \
        $(top_srcdir)/lib/setproctitle.c
+sulogin_SOURCES = \
+       sulogin.c \
+       $(top_srcdir)/lib/strutils.c
 vipw_SOURCES = \
        vipw.c \
        setpwnam.h
index 657bb6b443c43e98cd7fbf682f1f03c19ddef409..999fc2085a66fc3d476689b06a31a8d6c8077531 100644 (file)
@@ -48,8 +48,9 @@
 #include "c.h"
 #include "nls.h"
 #include "pathnames.h"
+#include "strutils.h"
 
-static int timeout;
+static unsigned int timeout;
 static int profile;
 
 struct sigaction saved_sigint;
@@ -449,7 +450,7 @@ int main(int argc, char **argv)
        while ((c = getopt_long(argc, argv, "ehpt:V", longopts, NULL)) != -1) {
                switch(c) {
                case 't':
-                       timeout = atoi(optarg);
+                       timeout = strtoul_or_err(optarg, _("failed to parse timeout"));
                        break;
                case 'p':
                        profile = 1;