]> git.hungrycats.org Git - linux/commitdiff
Fix signedness tests in vsnprintf by making it explicit.
authorLinus Torvalds <torvalds@home.osdl.org>
Sat, 12 Jul 2003 05:50:01 +0000 (22:50 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Sat, 12 Jul 2003 05:50:01 +0000 (22:50 -0700)
It used to depend on us having a signed type (which in turn is
incorrect for the later division).

lib/vsprintf.c

index bc699e295bce939f45b31c0b16e4e38bd70185d7..0a12089169a61e5d2cb3f793ea6c9d803681462f 100644 (file)
@@ -143,9 +143,9 @@ static char * number(char * buf, char * end, unsigned long long num, int base, i
        c = (type & ZEROPAD) ? '0' : ' ';
        sign = 0;
        if (type & SIGN) {
-               if (num < 0) {
+               if ((signed long long) num < 0) {
                        sign = '-';
-                       num = -num;
+                       num = - (signed long long) num;
                        size--;
                } else if (type & PLUS) {
                        sign = '+';