Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 14 Dec 2001 07:19:20 +0000 (07:19 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 14 Dec 2001 07:19:20 +0000 (07:19 +0000)
2001-12-13  Ulrich Drepper  <drepper@redhat.com>

* stdio-common/tst-sprintf.c: New file.

2001-12-13  Andreas Schwab  <schwab@suse.de>

* stdio-common/vfprintf.c (process_string_arg): Correctly handle
zero precision with wide character string format.

ChangeLog
stdio-common/tst-sprintf.c [new file with mode: 0644]
stdio-common/vfprintf.c

index 95e1023..d9bccb9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2001-12-13  Ulrich Drepper  <drepper@redhat.com>
+
+       * stdio-common/tst-sprintf.c: New file.
+
+2001-12-13  Andreas Schwab  <schwab@suse.de>
+
+       * stdio-common/vfprintf.c (process_string_arg): Correctly handle
+       zero precision with wide character string format.
+
 2001-12-13  Thorsten Kukuk  <kukuk@suse.de>
 
        * sysdeps/posix/cuserid.c (cuserid): If we don't find the UID,
diff --git a/stdio-common/tst-sprintf.c b/stdio-common/tst-sprintf.c
new file mode 100644 (file)
index 0000000..afbacd9
--- /dev/null
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <string.h>
+
+
+int
+main (void)
+{
+  char buf[100];
+  int result = 0;
+
+  if (sprintf (buf, "%.0ls", L"foo") != 0
+      || strlen (buf) != 0)
+    {
+      puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output\n");
+      result = 1;
+    }
+
+  return result;
+}
index c5e78c7..febd094 100644 (file)
@@ -1195,7 +1195,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
                                                                              \
            memset (&mbstate, '\0', sizeof (mbstate_t));                      \
                                                                              \
-           if (prec > 0)                                                     \
+           if (prec >= 0)                                                    \
              {                                                               \
                /* The string `s2' might not be NUL terminated.  */           \
                if (prec < 32768                                              \