]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix sys/time.h timespec namespace (bug 20041).
authorJoseph Myers <joseph@codesourcery.com>
Tue, 3 May 2016 23:36:18 +0000 (23:36 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 3 May 2016 23:36:18 +0000 (23:36 +0000)
For UNIX98 and older standards, sys/time.h should not define struct
timespec, but does so via the inclusion of sys/select.h (which is a
new header in the 2001 edition of POSIX, and defines struct timespec
because of the declaration of pselect, a new function in the 2001
edition of POSIX).  In turn, this affects some other headers that
themselves include sys/time.h.

This patch fixes this by conditioning the __need_timespec definition
in sys/select.h on __USE_XOPEN2K, the same condition used there for
the declaration of pselect (this has no effect on direct uses of
sys/select.h with feature test macros for any standard that includes
that header, since such standards result in __USE_XOPEN2K being
defined).

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

[BZ #20041]
* misc/sys/select.h (__need_timespec): Only define if
[__USE_XOPEN2K].
* conform/Makefile (test-xfail-XPG4/sys/time.h/conform): Remove
variable.
(test-xfail-XPG4/utmpx.h/conform): Likewise.
(test-xfail-UNIX98/sys/time.h/conform): Likewise.
(test-xfail-UNIX98/utmpx.h/conform): Likewise.

ChangeLog
conform/Makefile
misc/sys/select.h

index 64d1bc722ef35bdb3594b894b9abc424212c78ad..35b127008a0e0e137076f54f493a5c6959277adb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2016-05-03  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #20041]
+       * misc/sys/select.h (__need_timespec): Only define if
+       [__USE_XOPEN2K].
+       * conform/Makefile (test-xfail-XPG4/sys/time.h/conform): Remove
+       variable.
+       (test-xfail-XPG4/utmpx.h/conform): Likewise.
+       (test-xfail-UNIX98/sys/time.h/conform): Likewise.
+       (test-xfail-UNIX98/utmpx.h/conform): Likewise.
+
 2016-05-03  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
            Segher Boessenkool  <segher@gcc.gnu.org>
 
index 55cada5e13c7b5898487f5d6cb7b79be15902263..d5273c174363b823d6d90ee89866fd13a168eac3 100644 (file)
@@ -184,24 +184,20 @@ test-xfail-XPG4/netinet/in.h/conform = yes
 test-xfail-XPG4/signal.h/conform = yes
 test-xfail-XPG4/stdlib.h/conform = yes
 test-xfail-XPG4/sys/stat.h/conform = yes
-test-xfail-XPG4/sys/time.h/conform = yes
 test-xfail-XPG4/sys/types.h/conform = yes
 test-xfail-XPG4/sys/wait.h/conform = yes
 test-xfail-XPG4/termios.h/conform = yes
 test-xfail-XPG4/ucontext.h/conform = yes
 test-xfail-XPG4/unistd.h/conform = yes
-test-xfail-XPG4/utmpx.h/conform = yes
 test-xfail-POSIX/sys/wait.h/conform = yes
 test-xfail-UNIX98/arpa/inet.h/conform = yes
 test-xfail-UNIX98/netdb.h/conform = yes
 test-xfail-UNIX98/netinet/in.h/conform = yes
 test-xfail-UNIX98/signal.h/conform = yes
 test-xfail-UNIX98/stdlib.h/conform = yes
-test-xfail-UNIX98/sys/time.h/conform = yes
 test-xfail-UNIX98/sys/wait.h/conform = yes
 test-xfail-UNIX98/ucontext.h/conform = yes
 test-xfail-UNIX98/unistd.h/conform = yes
-test-xfail-UNIX98/utmpx.h/conform = yes
 test-xfail-XOPEN2K/semaphore.h/conform = yes
 test-xfail-XOPEN2K/signal.h/conform = yes
 test-xfail-XOPEN2K/sys/wait.h/conform = yes
index b852dac2d89d24062dc02eff2367eed3ddad139c..52dd94fe01b06fc61b2181845be9a749f549e454 100644 (file)
@@ -39,7 +39,9 @@ typedef __sigset_t sigset_t;
 
 /* Get definition of timer specification structures.  */
 #define __need_time_t
-#define __need_timespec
+#ifdef __USE_XOPEN2K
+# define __need_timespec
+#endif
 #include <time.h>
 #define __need_timeval
 #include <bits/time.h>