summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/tst-printf.sh4
-rw-r--r--stdio-common/vfprintf.c10
2 files changed, 14 insertions, 0 deletions
diff --git a/stdio-common/tst-printf.sh b/stdio-common/tst-printf.sh
index e6e3327a17..0c5d784d68 100644
--- a/stdio-common/tst-printf.sh
+++ b/stdio-common/tst-printf.sh
@@ -134,6 +134,8 @@ prefix  6d      6o      6x      6X      6u
 0.10000000000000009
 Test ok.
 sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
+printf ("%hhu", 257) = 1
+printf ("%hu", 65537) = 1
 --- Should be no further output. ---
 EOF
 cmp - ${common_objpfx}stdio-common/tst-printf.out >& /dev/null ||
@@ -243,6 +245,8 @@ prefix  6d      6o      6x      6X      6u
 0.10000000000000009
 Test ok.
 sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
+printf ("%hhu", 257) = 1
+printf ("%hu", 65537) = 1
 --- Should be no further output. ---
 EOF
 cmp - ${common_objpfx}stdio-common/tst-printf.out >& /dev/null ||
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index adfb65100c..822728e7e7 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -2062,6 +2062,11 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format,
   register _IO_FILE *hp = (_IO_FILE *) &helper._f;
   int result, to_flush;
 
+  /* Orient the stream.  */
+#ifdef ORIENT
+  ORIENT;
+#endif
+
   /* Initialize helper.  */
   helper._put_stream = s;
 #ifdef COMPILE_WPRINTF
@@ -2122,6 +2127,11 @@ buffered_vfprintf (register FILE *s, const CHAR_T *format, va_list args)
   char buf[BUFSIZ];
   int result;
 
+  /* Orient the stream.  */
+#ifdef ORIENT
+  ORIENT;
+#endif
+
   s->__bufp = s->__buffer = buf;
   s->__bufsize = sizeof buf;
   s->__put_limit = s->__buffer + s->__bufsize;