Fix wait3 namespace (bug 21625)

Message ID alpine.DEB.2.20.1706191616290.27712@digraph.polyomino.org.uk
State New, archived
Headers

Commit Message

Joseph Myers June 19, 2017, 4:17 p.m. UTC
  The wait3 function was removed in the 2001 edition of POSIX.
sys/wait.h wrongly declares it for the 2001 and 2008 editions of POSIX
when XSI features are enabled.  This patch fixes the conditionals.

Tested for x86_64.

2017-06-19  Joseph Myers  <joseph@codesourcery.com>

	[BZ #21625]
	* posix/sys/wait.h (strust rusage forward declaration): Change
	[__USE_XOPEN_EXTENDED] conditional to [__USE_XOPEN_EXTENDED &&
	!__USE_XOPEN2K].
	(wait3): Likewise.
  

Comments

Florian Weimer June 19, 2017, 4:24 p.m. UTC | #1
On 06/19/2017 06:17 PM, Joseph Myers wrote:
> The wait3 function was removed in the 2001 edition of POSIX.
> sys/wait.h wrongly declares it for the 2001 and 2008 editions of POSIX
> when XSI features are enabled.  This patch fixes the conditionals.
> 
> Tested for x86_64.
> 
> 2017-06-19  Joseph Myers  <joseph@codesourcery.com>
> 
> 	[BZ #21625]
> 	* posix/sys/wait.h (strust rusage forward declaration): Change
> 	[__USE_XOPEN_EXTENDED] conditional to [__USE_XOPEN_EXTENDED &&
> 	!__USE_XOPEN2K].
> 	(wait3): Likewise.

Looks okay to me based on your explanation.

Thanks,
Florian
  

Patch

diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index 29ca453..6bb6668 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -133,7 +133,8 @@  extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
 		   int __options);
 #endif
 
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC \
+    || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K)
 /* This being here makes the prototypes valid whether or not
    we have already included <sys/resource.h> to define `struct rusage'.  */
 struct rusage;