diff options
author | Colin Watson <cjwatson@debian.org> | 2014-10-07 12:13:50 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-10-07 12:13:50 +0100 |
commit | 487bdb3a5ef6075887b830ccb8a0b14f6da78e93 (patch) | |
tree | a2cff6fec1e6c4b4153a170a3e172cfe6bfdec46 /openbsd-compat/kludge-fd_set.c | |
parent | 796ba4fd011b5d0d9d78d592ba2f30fc9d5ed2e7 (diff) | |
parent | 28453d58058a4d60c3ebe7d7f0c31a510cbf6158 (diff) |
Import openssh_6.7p1.orig.tar.gz
Diffstat (limited to 'openbsd-compat/kludge-fd_set.c')
-rw-r--r-- | openbsd-compat/kludge-fd_set.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/openbsd-compat/kludge-fd_set.c b/openbsd-compat/kludge-fd_set.c new file mode 100644 index 000000000..6c2ffb64b --- /dev/null +++ b/openbsd-compat/kludge-fd_set.c | |||
@@ -0,0 +1,28 @@ | |||
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> | ||
19 | void kludge_FD_SET(int n, fd_set *set) { | ||
20 | FD_SET(n, set); | ||
21 | } | ||
22 | int 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 | |||