Browse Source

Fix bug with %c... takes care of bug reported with busybox ps.

Manuel Novoa III 24 years ago
parent
commit
a8e2b7557d
1 changed files with 6 additions and 3 deletions
  1. 6 3
      libc/stdio/scanf.c

+ 6 - 3
libc/stdio/scanf.c

@@ -299,10 +299,13 @@ va_list ap;
 					scan_ungetc(&sc);
 				}
 				if (p-spec < 5) { /* [,c,s - string conversions */
-					if ((*p == 'c') && (sc.width == INT_MAX)) {
-						sc.width = 1;
-					}
 					invert = 0;
+					if (*p == 'c') {
+						invert = 1;
+						if (sc.width == INT_MAX) {
+							sc.width = 1;
+						}
+					}
 					for (i=0 ; i<= UCHAR_MAX ; i++) {
 						scanset[i] = ((*p == 's') ? (isspace(i) == 0) : 0);
 					}