]> sourceware.org Git - glibc.git/commitdiff
Fix open_memstream namespace (bug 18498).
authorJoseph Myers <joseph@codesourcery.com>
Fri, 5 Jun 2015 23:32:46 +0000 (23:32 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 5 Jun 2015 23:32:46 +0000 (23:32 +0000)
open_memstream is new in the 2008 edition of POSIX.  However, the
older functions getopt, closelog and fmtmsg all bring in references to
it.  This patch fixes this in the usual way, making open_memstream
into a weak alias of __open_memstream and calling __open_memstream
from the relevant places.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).  32-bit builds
produce an XPASS for conform/POSIX/unistd.h/linknamespace after this
patch (because the only cause of failure left there now is 64-bit
specific); that will disappear once the 64-bit failure is resolved and
the XFAIL removed at that time.

[BZ #18498]
* libio/memstream.c (open_memstream): Rename to __open_memstream
and define as weak alias of __open_memstream.
* include/stdio.h (__open_memstream): Declare.  Use
libc_hidden_proto.
(open_memstream): Don't use libc_hidden_proto.
* misc/syslog.c (__vsyslog_chk): Call __open_memstream instead of
open_memstream.
* posix/getopt.c (_getopt_internal_r): Likewise.
* conform/Makefile (test-xfail-XPG3/stdio.h/linknamespace): Remove
variable.
(test-xfail-XPG4/stdio.h/linknamespace): Likewise.
(test-xfail-UNIX98/stdio.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/unistd.h/linknamespace): Likewise.

ChangeLog
NEWS
conform/Makefile
include/stdio.h
libio/memstream.c
misc/syslog.c
posix/getopt.c

index 19f45eb99d84d0514d2914ab527efb01c50e0546..085d12ccd60cc9b61b0d58e4750dadcd4179ba39 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2015-06-05  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #18498]
+       * libio/memstream.c (open_memstream): Rename to __open_memstream
+       and define as weak alias of __open_memstream.
+       * include/stdio.h (__open_memstream): Declare.  Use
+       libc_hidden_proto.
+       (open_memstream): Don't use libc_hidden_proto.
+       * misc/syslog.c (__vsyslog_chk): Call __open_memstream instead of
+       open_memstream.
+       * posix/getopt.c (_getopt_internal_r): Likewise.
+       * conform/Makefile (test-xfail-XPG3/stdio.h/linknamespace): Remove
+       variable.
+       (test-xfail-XPG4/stdio.h/linknamespace): Likewise.
+       (test-xfail-UNIX98/stdio.h/linknamespace): Likewise.
+       (test-xfail-XOPEN2K/unistd.h/linknamespace): Likewise.
+
        [BZ #18496]
        * posix/regex_internal.c (build_wcs_upper_buffer): Call __wcrtomb
        instead of wcrtomb.
diff --git a/NEWS b/NEWS
index 3fc313c8badce12a210f977b51803ffc20acda59..881e61c4f25c00770410180ca9c9db72a7949238 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,7 +20,7 @@ Version 2.22
   18111, 18116, 18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210,
   18211, 18217, 18220, 18221, 18234, 18244, 18247, 18287, 18319, 18324,
   18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434, 18444,
-  18468, 18469, 18470, 18483, 18495, 18496.
+  18468, 18469, 18470, 18483, 18495, 18496, 18498.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index 662ea96d16756d76b09c3614efb9321e311961ef..943a1967fbbddf58d89d20b894bbbc5843a77b81 100644 (file)
@@ -347,14 +347,12 @@ test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes
 # Unsorted expected failures.
 test-xfail-XPG3/glob.h/linknamespace = yes
 test-xfail-XPG3/regex.h/linknamespace = yes
-test-xfail-XPG3/stdio.h/linknamespace = yes
 test-xfail-XPG3/unistd.h/linknamespace = yes
 test-xfail-XPG3/wordexp.h/linknamespace = yes
 test-xfail-XPG4/fmtmsg.h/linknamespace = yes
 test-xfail-XPG4/glob.h/linknamespace = yes
 test-xfail-XPG4/netdb.h/linknamespace = yes
 test-xfail-XPG4/regex.h/linknamespace = yes
-test-xfail-XPG4/stdio.h/linknamespace = yes
 test-xfail-XPG4/stdlib.h/linknamespace = yes
 test-xfail-XPG4/syslog.h/linknamespace = yes
 test-xfail-XPG4/unistd.h/linknamespace = yes
@@ -367,7 +365,6 @@ test-xfail-POSIX/unistd.h/linknamespace = yes
 test-xfail-UNIX98/fmtmsg.h/linknamespace = yes
 test-xfail-UNIX98/mqueue.h/linknamespace = yes
 test-xfail-UNIX98/netdb.h/linknamespace = yes
-test-xfail-UNIX98/stdio.h/linknamespace = yes
 test-xfail-UNIX98/stdlib.h/linknamespace = yes
 test-xfail-UNIX98/syslog.h/linknamespace = yes
 test-xfail-UNIX98/unistd.h/linknamespace = yes
@@ -376,7 +373,6 @@ test-xfail-XOPEN2K/fmtmsg.h/linknamespace = yes
 test-xfail-XOPEN2K/netdb.h/linknamespace = yes
 test-xfail-XOPEN2K/stdlib.h/linknamespace = yes
 test-xfail-XOPEN2K/syslog.h/linknamespace = yes
-test-xfail-XOPEN2K/unistd.h/linknamespace = yes
 test-xfail-POSIX2008/grp.h/linknamespace = yes
 test-xfail-POSIX2008/netdb.h/linknamespace = yes
 test-xfail-POSIX2008/semaphore.h/linknamespace = yes
index 043b2b56bcfe4bc987c23ce757ac192e6574acc8..78bd3c471badc20cd9a22628b43c5f1b7ea7d1a7 100644 (file)
@@ -160,7 +160,10 @@ extern __typeof (fgets_unlocked) __fgets_unlocked;
 libc_hidden_proto (__fgets_unlocked)
 libc_hidden_proto (fputs_unlocked)
 libc_hidden_proto (fmemopen)
-libc_hidden_proto (open_memstream)
+/* The prototype needs repeating instead of using __typeof to use
+   __THROW in C++.  */
+extern FILE *__open_memstream (char **, size_t *) __THROW __wur;
+libc_hidden_proto (__open_memstream)
 libc_hidden_proto (__libc_fatal)
 libc_hidden_proto (__vsprintf_chk)
 libc_hidden_proto (__vsnprintf_chk)
index 81bfe6dd6712f82476d9b7a78edbbebcdd0f3b5d..84742d123609437c455de8883ed93851a4bbde52 100644 (file)
@@ -61,7 +61,7 @@ static const struct _IO_jump_t _IO_mem_jumps =
    necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
    and the number of characters written on fflush or fclose.  */
 _IO_FILE *
-open_memstream (bufloc, sizeloc)
+__open_memstream (bufloc, sizeloc)
      char **bufloc;
      _IO_size_t *sizeloc;
 {
@@ -100,7 +100,8 @@ open_memstream (bufloc, sizeloc)
 
   return (_IO_FILE *) &new_f->fp._sf._sbf;
 }
-libc_hidden_def (open_memstream)
+libc_hidden_def (__open_memstream)
+weak_alias (__open_memstream, open_memstream)
 
 
 static int
index 70daa9e1f3b7b74534ee2c269a3a1f563d8335ab..23a4f7b81d27749b984a775f3706a43311debcab 100644 (file)
@@ -164,7 +164,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
                pri |= LogFacility;
 
        /* Build the message in a memory-buffer stream.  */
-       f = open_memstream (&buf, &bufsize);
+       f = __open_memstream (&buf, &bufsize);
        if (f == NULL)
          {
            /* We cannot get a stream.  There is not much we can do but
index 841392e5bbb747085a6aa7d2745a2f8713d3d2c5..d30530f939426886226e2e7f6abd910364a1b189 100644 (file)
@@ -585,7 +585,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
              char *buf = NULL;
              size_t buflen = 0;
 
-             FILE *fp = open_memstream (&buf, &buflen);
+             FILE *fp = __open_memstream (&buf, &buflen);
              if (fp != NULL)
                {
                  fprintf (fp,
This page took 0.204606 seconds and 5 git commands to generate.