bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] sys_select: fix FD_ZERO problem on Solaris 10


From: Paul Eggert
Subject: [PATCH 2/2] sys_select: fix FD_ZERO problem on Solaris 10
Date: Tue, 5 Aug 2014 13:22:40 -0700

* lib/sys_select.in.h: Fix Solaris 10 bug where "#include
<sys/time.h>" followed by "#include <sys/select.h>" caused FD_ZERO
to expand to an expression that invoked memset without necessarily
including <string.h>.  The problem was that the first include
defined _SYS_TIME_H, causing the second include to short-circuit.
Fix a similar problem with <sys/types.h> followed by <sys/select.h>.
Also, fix what appears to be a cut-and-paste typo, by replacing
_GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H with
_GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H.
---
 ChangeLog           | 11 +++++++++++
 lib/sys_select.in.h | 15 ++++++++-------
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 43b8fe3..8e74a54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2014-08-05  Paul Eggert  <address@hidden>
 
+       sys_select: fix FD_ZERO problem on Solaris 10
+       * lib/sys_select.in.h: Fix Solaris 10 bug where "#include
+       <sys/time.h>" followed by "#include <sys/select.h>" caused FD_ZERO
+       to expand to an expression that invoked memset without necessarily
+       including <string.h>.  The problem was that the first include
+       defined _SYS_TIME_H, causing the second include to short-circuit.
+       Fix a similar problem with <sys/types.h> followed by <sys/select.h>.
+       Also, fix what appears to be a cut-and-paste typo, by replacing
+       _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H with
+       _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H.
+
        accept: document Solaris 10 type glitch
        * doc/posix-functions/accept.texi (accept): Mention that
        Solaris 10 'accept' takes void * last arg, not socklen_t *.
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 6ac7b08..1186f68 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -24,8 +24,8 @@
    On Cygwin, <sys/time.h> includes <sys/select.h>.
    Simply delegate to the system's header in this case.  */
 #if (@HAVE_SYS_SELECT_H@                                                \
+     && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H             \
      && ((defined __osf__ && defined _SYS_TYPES_H_                      \
-          && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H         \
           && defined _OSF_SOURCE)                                       \
          || (defined __sun && defined _SYS_TYPES_H                      \
              && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE)   \
@@ -36,12 +36,13 @@
 
 #elif (@HAVE_SYS_SELECT_H@                                              \
        && (defined _CYGWIN_SYS_TIME_H                                   \
-           || (defined __osf__ && defined _SYS_TIME_H_                  \
-               && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H    \
-               && defined _OSF_SOURCE)                                  \
-           || (defined __sun && defined _SYS_TIME_H                     \
-               && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
-                   || defined __EXTENSIONS__))))
+           || (!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H       \
+               && ((defined __osf__ && defined _SYS_TIME_H_             \
+                    && defined _OSF_SOURCE)                             \
+                   || (defined __sun && defined _SYS_TIME_H             \
+                       && (! (defined _XOPEN_SOURCE                     \
+                              || defined _POSIX_C_SOURCE)               \
+                           || defined __EXTENSIONS__))))))
 
 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]