]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix syslog dprintf namespace (bug 18534).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 17 Jun 2015 20:10:50 +0000 (20:10 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 17 Jun 2015 20:10:50 +0000 (20:10 +0000)
syslog functions bring in references to dprintf, which wasn't added to
POSIX until the 2008 edition and so isn't in various standards
containing the syslog functions.  This patch fixes this by making
dprintf into a weak alias of __dprintf and using __dprintf as
appropriate.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

[BZ #18534]
* stdio-common/dprintf.c (__dprintf): Use libc_hidden_def.
(dprintf): Define as a weak alias of __dprintf, not a strong
alias.
* include/stdio.h (__dprintf): Declare.  Use libc_hidden_proto.
* misc/syslog.c (__vsyslog_chk): Call __dprintf instead of
dprintf.
* conform/Makefile (test-xfail-XPG4/syslog.h/linknamespace):
Remove variable.
(test-xfail-UNIX98/syslog.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/syslog.h/linknamespace): Likewise.

ChangeLog
NEWS
conform/Makefile
include/stdio.h
misc/syslog.c
stdio-common/dprintf.c

index 3d03d20f7c7fd379d737ea8b2c54eafc13f088b3..abc52cc07b8abdffc430f297bfb226a85ba982fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2015-06-17  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #18534]
+       * stdio-common/dprintf.c (__dprintf): Use libc_hidden_def.
+       (dprintf): Define as a weak alias of __dprintf, not a strong
+       alias.
+       * include/stdio.h (__dprintf): Declare.  Use libc_hidden_proto.
+       * misc/syslog.c (__vsyslog_chk): Call __dprintf instead of
+       dprintf.
+       * conform/Makefile (test-xfail-XPG4/syslog.h/linknamespace):
+       Remove variable.
+       (test-xfail-UNIX98/syslog.h/linknamespace): Likewise.
+       (test-xfail-XOPEN2K/syslog.h/linknamespace): Likewise.
+
        [BZ #18533]
        * misc/syslog.c (vsyslog): Define as a weak alias of __vsyslog,
        not a strong alias.
diff --git a/NEWS b/NEWS
index ad388adbc3d02ba0a4ba0a84bd203ad363e5d210..a0ebe5898980c3a435eb6cfc8b5421c9f9c5a883 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,7 +22,7 @@ Version 2.22
   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, 18530, 18532,
-  18533.
+  18533, 18534.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index 567046fd16c3738df7c1f7dc04e1c8a16d2a7688..9347b0f6a83aa35708eb3c564091df0a656ed4a9 100644 (file)
@@ -346,16 +346,13 @@ test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes
 # Unsorted expected failures.
 test-xfail-XPG3/unistd.h/linknamespace = yes
 test-xfail-XPG4/fmtmsg.h/linknamespace = yes
-test-xfail-XPG4/syslog.h/linknamespace = yes
 test-xfail-XPG4/unistd.h/linknamespace = yes
 test-xfail-POSIX/mqueue.h/linknamespace = yes
 test-xfail-POSIX/semaphore.h/linknamespace = yes
 test-xfail-UNIX98/fmtmsg.h/linknamespace = yes
 test-xfail-UNIX98/mqueue.h/linknamespace = yes
-test-xfail-UNIX98/syslog.h/linknamespace = yes
 test-xfail-UNIX98/unistd.h/linknamespace = yes
 test-xfail-UNIX98/wchar.h/linknamespace = yes
 test-xfail-XOPEN2K/fmtmsg.h/linknamespace = yes
-test-xfail-XOPEN2K/syslog.h/linknamespace = yes
 test-xfail-POSIX2008/semaphore.h/linknamespace = yes
 test-xfail-XOPEN2K8/fmtmsg.h/linknamespace = yes
index 6ae70a35f49394af6355195513dd4a37326c805f..9cd324bfe00313c64c0d38e4d3e4ece65fb848c8 100644 (file)
@@ -135,6 +135,9 @@ extern int _IO_new_fgetpos (_IO_FILE *, _IO_fpos_t *);
 #  endif
 
 libc_hidden_proto (dprintf)
+extern __typeof (dprintf) __dprintf
+     __attribute__ ((__format__ (__printf__, 2, 3)));
+libc_hidden_proto (__dprintf)
 libc_hidden_proto (fprintf)
 libc_hidden_proto (vfprintf)
 libc_hidden_proto (sprintf)
index 35cae6c0771ce5ffe4aa7288dae5766c7c6fa000..9dd4cde18ce138b57d879102cfb726dc2a169e0a 100644 (file)
@@ -298,7 +298,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
                if (LogStat & LOG_CONS &&
                    (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
                  {
-                   dprintf (fd, "%s\r\n", buf + msgoff);
+                   __dprintf (fd, "%s\r\n", buf + msgoff);
                    (void)__close(fd);
                  }
              }
index 3221cf0122cc7caa017a77cb255a9ac46b9cbdd1..5a7011dc5248dfc9c6db70ad0f98f338cbac3f1e 100644 (file)
@@ -35,5 +35,6 @@ __dprintf (int d, const char *format, ...)
 
   return done;
 }
+libc_hidden_def (__dprintf)
 ldbl_hidden_def (__dprintf, dprintf)
-ldbl_strong_alias (__dprintf, dprintf)
+ldbl_weak_alias (__dprintf, dprintf)