summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/stdio/scanf.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c
index 7070727d9..dbb6f8d61 100644
--- a/libc/stdio/scanf.c
+++ b/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);
}