[BusyBox-cvs] busybox/init init.c,1.196,1.197

Erik Andersen andersen at busybox.net
Mon Sep 15 08:11:34 UTC 2003


Update of /var/cvs/busybox/init
In directory winder:/tmp/cvs-serv9881/init

Modified Files:
	init.c 
Log Message:
comparison was always false due to limited range of data types.
Carefully cast to unsigned long long prior to multiply to get
the expected result.


Index: init.c
===================================================================
RCS file: /var/cvs/busybox/init/init.c,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -d -r1.196 -r1.197
--- init.c	11 Sep 2003 08:51:32 -0000	1.196
+++ init.c	15 Sep 2003 08:11:29 -0000	1.197
@@ -333,7 +333,7 @@
 		s--;
 	}
 	result = (info.totalram >> s) + (info.totalswap >> s);
-	if ((unsigned long long) (result * u) > UINT_MAX) {
+	if (((unsigned long long)result * (unsigned long long)u) > UINT_MAX) {
 		return(UINT_MAX);
 	} else {
 		return(result * u);




More information about the busybox-cvs mailing list