aboutsummaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-03-06 22:11:45 +0000
committerEric Andersen <andersen@codepoet.org>2004-03-06 22:11:45 +0000
commit2479445562a9b5a9f226d0b00c41dbd533e63213 (patch)
treee4891420283c085d688683a41cc217dc896917b8 /loginutils
parentc4db0833a6c91dd3714bec1db076a80910af6e30 (diff)
downloadbusybox-2479445562a9b5a9f226d0b00c41dbd533e63213.tar.gz
Fix/eliminate use of atol
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/getty.c17
1 files changed, 5 insertions, 12 deletions
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 */