summaryrefslogtreecommitdiff
path: root/libc/stdio/scanf.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2001-03-15 19:31:09 +0000
committerManuel Novoa III <mjn3@codepoet.org>2001-03-15 19:31:09 +0000
commita8e2b7557d99719bf89baee473c4db736745d158 (patch)
tree7aad36e82fab93b97810b1c8ebcfddbbd2a26fe0 /libc/stdio/scanf.c
parent11a46906d0adb2405167330930b1af139991ec3e (diff)
Fix bug with %c... takes care of bug reported with busybox ps.
Diffstat (limited to 'libc/stdio/scanf.c')
-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);
}