bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: %.1s format with vasnprintf reads more than one byte from argument


From: Eric Blake
Subject: Re: %.1s format with vasnprintf reads more than one byte from argument
Date: Fri, 27 Feb 2009 15:51:56 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> +# printf.m4 serial 32
>  dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
>  dnl This file is free software; the Free Software Foundation
>  dnl gives unlimited permission to copy and/or distribute it,
> @@ -653,13 +653,19 @@ int main ()
>  {
>    char buf[100];
>    /* Test whether %ls works at all.
> -     This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.  */
> +     This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku,
> +     Cygwin 1.5.  */
>    {
>      static const wchar_t wstring[] = { 'a', 'b', 'c', 0 };
>      buf[0] = '\0';
>      if (sprintf (buf, "%ls", wstring) < 0
>          || strcmp (buf, "abc") != 0)
>        return 1;
> +    buf[0] = '\0';
> +    wstring[1] = 0;

Oops.  This makes the test fail, even on Linux, if the compiler refuses to 
change a const wstring element.  Committing this obvious followup.


From: Eric Blake <address@hidden>
Date: Fri, 27 Feb 2009 08:46:07 -0700
Subject: [PATCH] printf: fix regression in previous patch

* m4/printf.m4 (gl_PRINTF_DIRECTIVE_LS): Fix compilation error.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog    |    5 ++++-
 m4/printf.m4 |    4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9946a0c..f282e3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-02-27  Eric Blake  <address@hidden>

+       printf: fix regression in previous patch
+       * m4/printf.m4 (gl_PRINTF_DIRECTIVE_LS): Fix compilation error.
+
        doc: mention more functions added in cygwin 1.7.0
        * doc/posix-functions/mbsnrtowcs.texi: Mention recent cygwin 1.7.0
        addition.
diff --git a/m4/printf.m4 b/m4/printf.m4
index 6da62df..4142b9b 100644
--- a/m4/printf.m4
+++ b/m4/printf.m4
@@ -1,4 +1,4 @@
-# printf.m4 serial 32
+# printf.m4 serial 33
 dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -656,7 +656,7 @@ int main ()
      This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku,
      Cygwin 1.5.  */
   {
-    static const wchar_t wstring[] = { 'a', 'b', 'c', 0 };
+    static wchar_t wstring[] = { 'a', 'b', 'c', 0 };
     buf[0] = '\0';
     if (sprintf (buf, "%ls", wstring) < 0
         || strcmp (buf, "abc") != 0)
-- 
1.6.1.2








reply via email to

[Prev in Thread] Current Thread [Next in Thread]