summaryrefslogtreecommitdiffstats
path: root/libc/stdio
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-09-23 16:02:39 -0700
committerElliott Hughes <enh@google.com>2013-09-23 16:02:39 -0700
commit1d13c64d781a87dfa3f01e5c179bfa36748786af (patch)
treef50fd074ebb7a749ff0bbb2069e3145cd67cd3ba /libc/stdio
parentfc2ceae778afdcb2deee4abb5e2fc9b9904fa761 (diff)
downloadbionic-1d13c64d781a87dfa3f01e5c179bfa36748786af.zip
bionic-1d13c64d781a87dfa3f01e5c179bfa36748786af.tar.gz
bionic-1d13c64d781a87dfa3f01e5c179bfa36748786af.tar.bz2
Fix %hhd formats in the printf family.
Found by adapting the simple unit tests for libc logging to test snprintf too. Fix taken from upstream OpenBSD without updating the rest of stdio. Change-Id: Ie339a8e9393a36080147aae4d6665118e5d93647
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/local.h2
-rw-r--r--libc/stdio/vfprintf.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/libc/stdio/local.h b/libc/stdio/local.h
index e3a40bc..a175d6f 100644
--- a/libc/stdio/local.h
+++ b/libc/stdio/local.h
@@ -93,3 +93,5 @@ extern int __sdidinit;
#define FLOCKFILE(fp) do { if (__isthreaded) flockfile(fp); } while (0)
#define FUNLOCKFILE(fp) do { if (__isthreaded) funlockfile(fp); } while (0)
+
+#define FLOATING_POINT
diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c
index 646b6b1..b101145 100644
--- a/libc/stdio/vfprintf.c
+++ b/libc/stdio/vfprintf.c
@@ -451,7 +451,12 @@ reswitch: switch (ch) {
goto rflag;
#endif
case 'h':
- flags |= SHORTINT;
+ if (*fmt == 'h') {
+ fmt++;
+ flags |= CHARINT;
+ } else {
+ flags |= SHORTINT;
+ }
goto rflag;
case 'j':
flags |= MAXINT;