1/* Placed in the public domain. */ 2 3/* 4 * _FORTIFY_SOURCE includes a misguided check for FD_SET(n)/FD_ISSET(b) 5 * where n > FD_SETSIZE. This breaks OpenSSH and other programs that 6 * explicitly allocate fd_sets. To avoid this, we wrap FD_SET in a 7 * function compiled without _FORTIFY_SOURCE. 8 */ 9 10#include "config.h" 11 12#if defined(HAVE_FEATURES_H) && defined(_FORTIFY_SOURCE) 13# include <features.h> 14# if defined(__GNU_LIBRARY__) && defined(__GLIBC_PREREQ) 15# if __GLIBC_PREREQ(2, 15) && (_FORTIFY_SOURCE > 0) 16# undef _FORTIFY_SOURCE 17# undef __USE_FORTIFY_LEVEL 18# include <sys/socket.h> 19void kludge_FD_SET(int n, fd_set *set) { 20 FD_SET(n, set); 21} 22int kludge_FD_ISSET(int n, fd_set *set) { 23 return FD_ISSET(n, set); 24} 25# endif /* __GLIBC_PREREQ(2, 15) && (_FORTIFY_SOURCE > 0) */ 26# endif /* __GNU_LIBRARY__ && __GLIBC_PREREQ */ 27#endif /* HAVE_FEATURES_H && _FORTIFY_SOURCE */ 28 29