]> Savannah Git Hosting - gnulib.git/commitdiff
sys_select: fix FD_ZERO problem on Solaris 10
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 5 Aug 2014 20:19:57 +0000 (13:19 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 5 Aug 2014 20:22:11 +0000 (13:22 -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
lib/sys_select.in.h

index 43b8fe3ef3f12c4128976393fe50316b2bf1b18a..8e74a548d79443739cf3d4bf035fb40ef2a5988f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2014-08-05  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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 *.
index 6ac7b084f3ce5dc37c5870a6bd8bdf6991087b2e..1186f68212e3ba89473adf0609d7bfe427f72147 100644 (file)
@@ -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)   \
 
 #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@