From 2479445562a9b5a9f226d0b00c41dbd533e63213 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sat, 6 Mar 2004 22:11:45 +0000 Subject: Fix/eliminate use of atol --- loginutils/getty.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'loginutils') diff --git a/loginutils/getty.c b/loginutils/getty.c index 4219ff821..b12b88fb1 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c @@ -955,22 +955,15 @@ static int caps_lock(const char *s) /* bcode - convert speed string to speed code; return 0 on failure */ static int bcode(const char *s) { -#if 0 - struct Speedtab *sp; - long speed = atol(s); - - for (sp = speedtab; sp->speed; sp++) - if (sp->speed == speed) - return (sp->code); - return (0); -#else int r; - - if ((r = bb_value_to_baud(atol(s))) > 0) { + unsigned long value; + if (safe_strtoul(s, &value)) { + return -1; + } + if ((r = bb_value_to_baud(value)) > 0) { return r; } return 0; -#endif } /* error - report errors to console or syslog; only understands %s and %m */ -- cgit v1.2.3