]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix syslog fputs_unlocked namespace (bug 18530).
authorJoseph Myers <joseph@codesourcery.com>
Fri, 12 Jun 2015 22:36:38 +0000 (22:36 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 12 Jun 2015 22:36:38 +0000 (22:36 +0000)
syslog (XSI POSIX) brings in references to fputs_unlocked (not
POSIX).  This patch fixes this by making fputs_unlocked into a weak
alias for __fputs_unlocked and using __fputs_unlocked as needed.  (No
linknamespace test XFAILs are removed because there are other failures
from syslog as well.)

Tested for x86_64 and x86 (testsuite, and comparison of disassembly of
installed stripped shared libraries).  Disassembly of installed
stripped shared libraries is unchanged on x86_64; on x86, I see some
small changes to instruction ordering and register choice, with no
apparent reason for such changes to be related to this patch, but they
also seem completely harmless with no change to code size.

[BZ #18530]
* libio/iofputs.c [!_IO_MTSAFE_IO] (__fputs_unlocked): Define as
strong alias of _IO_fputs.  Use libc_hidden_def.
* libio/iofputs_u.c (fputs_unlocked): Rename to __fputs_unlocked
and define as weak alias of __fputs_unlocked.  Use
libc_hidden_weak.
* include/stdio.h (__fputs_unlocked): Declare.  Use
libc_hidden_proto.
* misc/syslog.c (__vsyslog_chk): Call __fputs_unlocked instead of
fputs_unlocked.

ChangeLog
NEWS
include/stdio.h
libio/iofputs.c
libio/iofputs_u.c
misc/syslog.c

index a16069deeedb11468295d7ec0573b9d9190e085b..62302505d71f33c6817841ac83e19a9516fa518e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2015-06-12  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #18530]
+       * libio/iofputs.c [!_IO_MTSAFE_IO] (__fputs_unlocked): Define as
+       strong alias of _IO_fputs.  Use libc_hidden_def.
+       * libio/iofputs_u.c (fputs_unlocked): Rename to __fputs_unlocked
+       and define as weak alias of __fputs_unlocked.  Use
+       libc_hidden_weak.
+       * include/stdio.h (__fputs_unlocked): Declare.  Use
+       libc_hidden_proto.
+       * misc/syslog.c (__vsyslog_chk): Call __fputs_unlocked instead of
+       fputs_unlocked.
+
        [BZ #18529]
        * resolv/netdb.h [__USE_POSIX]: Change condition to
        [__USE_XOPEN2K].
diff --git a/NEWS b/NEWS
index 592fa4583aad4b7844f6ff90209636368dfb856f..1f81c7d999e88ce982dd94e73d660ecb708a5d70 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,7 +21,7 @@ Version 2.22
   18211, 18217, 18220, 18221, 18234, 18244, 18247, 18287, 18319, 18324,
   18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434, 18444,
   18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498, 18507,
-  18512, 18519, 18520, 18522, 18527, 18528, 18529.
+  18512, 18519, 18520, 18522, 18527, 18528, 18529, 18530.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index 489e41999d01dc738e018c290158cb93c21dc5fe..6ae70a35f49394af6355195513dd4a37326c805f 100644 (file)
@@ -159,6 +159,8 @@ libc_hidden_proto (fgets_unlocked)
 extern __typeof (fgets_unlocked) __fgets_unlocked;
 libc_hidden_proto (__fgets_unlocked)
 libc_hidden_proto (fputs_unlocked)
+extern __typeof (fputs_unlocked) __fputs_unlocked;
+libc_hidden_proto (__fputs_unlocked)
 libc_hidden_proto (fmemopen)
 /* The prototype needs repeating instead of using __typeof to use
    __THROW in C++ tests.  */
index 00c1cba5da89f80e6deaedbaa983b32d74f6b6bc..d1e34e40b4a4546a5390fa25eadc867fe5f159d9 100644 (file)
@@ -48,6 +48,8 @@ libc_hidden_def (_IO_fputs)
 weak_alias (_IO_fputs, fputs)
 
 # ifndef _IO_MTSAFE_IO
+strong_alias (_IO_fputs, __fputs_unlocked)
+libc_hidden_def (__fputs_unlocked)
 weak_alias (_IO_fputs, fputs_unlocked)
 libc_hidden_ver (_IO_fputs, fputs_unlocked)
 # endif
index 6f79838eae7303122552049e62fa479dac279e89..f823686d5b3dbff69d599e543f4656491cf3843c 100644 (file)
@@ -29,7 +29,7 @@
 #include <string.h>
 
 int
-fputs_unlocked (str, fp)
+__fputs_unlocked (str, fp)
       const char *str;
       _IO_FILE *fp;
 {
@@ -40,4 +40,6 @@ fputs_unlocked (str, fp)
     result = 1;
   return result;
 }
-libc_hidden_def (fputs_unlocked)
+libc_hidden_def (__fputs_unlocked)
+weak_alias (__fputs_unlocked, fputs_unlocked)
+libc_hidden_weak (fputs_unlocked)
index 23a4f7b81d27749b984a775f3706a43311debcab..3979f4240ec3f29475e7dc7ddc76e84f3780633b 100644 (file)
@@ -202,7 +202,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
            if (LogTag == NULL)
              LogTag = __progname;
            if (LogTag != NULL)
-             fputs_unlocked (LogTag, f);
+             __fputs_unlocked (LogTag, f);
            if (LogStat & LOG_PID)
              fprintf (f, "[%d]", (int) __getpid ());
            if (LogTag != NULL)