about summary refs log tree commit diff
path: root/misc/sys
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2016-05-03 23:36:18 +0000
committerJoseph Myers <joseph@codesourcery.com>2016-05-03 23:36:18 +0000
commit2faba597eca15666ce46cc721041747e96c8b942 (patch)
treeeb65e6ce835cb591d5a7f683eb4456a8ead83238 /misc/sys
parentcbc06bc486635347ee0da51d04a82eedf51602d5 (diff)
downloadglibc-2faba597eca15666ce46cc721041747e96c8b942.tar.gz
glibc-2faba597eca15666ce46cc721041747e96c8b942.tar.xz
glibc-2faba597eca15666ce46cc721041747e96c8b942.zip
Fix sys/time.h timespec namespace (bug 20041).
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.
Diffstat (limited to 'misc/sys')
-rw-r--r--misc/sys/select.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/misc/sys/select.h b/misc/sys/select.h
index b852dac2d8..52dd94fe01 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -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>