[BusyBox-cvs] busybox/loginutils getty.c,1.8,1.9

Erik Andersen andersen at busybox.net
Sat Mar 6 22:11:47 UTC 2004


Update of /var/cvs/busybox/loginutils
In directory nail:/tmp/cvs-serv7369/loginutils

Modified Files:
	getty.c 
Log Message:
Fix/eliminate use of atol


Index: getty.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/getty.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- a/getty.c	19 Mar 2003 09:12:20 -0000	1.8
+++ b/getty.c	6 Mar 2004 22:11:45 -0000	1.9
@@ -955,22 +955,15 @@
 /* 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 */




More information about the busybox-cvs mailing list