diff options
author | Colin Watson <cjwatson@debian.org> | 2010-01-15 00:52:35 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2010-01-15 00:52:35 +0000 |
commit | a28c610ba9d7c7c1f09585a8197454f45be71322 (patch) | |
tree | fb01c17642d80d86c9e71d3f3e8eaf0ee3bdcd15 /monitor_fdpass.c | |
parent | e2e22487121c994f951c633893dfe625c8681440 (diff) |
Drop change from 1:3.6.1p2-5 to disable cmsg_type check for file
descriptor passing when running on Linux 2.0. The previous stable
release of Debian dropped support for Linux 2.4, let alone 2.0, so this
very likely has no remaining users depending on it.
Diffstat (limited to 'monitor_fdpass.c')
-rw-r--r-- | monitor_fdpass.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/monitor_fdpass.c b/monitor_fdpass.c index 3d3a78391..4b9a066bc 100644 --- a/monitor_fdpass.c +++ b/monitor_fdpass.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #ifdef HAVE_SYS_UN_H | 32 | #ifdef HAVE_SYS_UN_H |
33 | #include <sys/un.h> | 33 | #include <sys/un.h> |
34 | #endif | 34 | #endif |
35 | #include <sys/utsname.h> | ||
36 | 35 | ||
37 | #include <errno.h> | 36 | #include <errno.h> |
38 | #include <string.h> | 37 | #include <string.h> |
@@ -41,29 +40,6 @@ | |||
41 | #include "log.h" | 40 | #include "log.h" |
42 | #include "monitor_fdpass.h" | 41 | #include "monitor_fdpass.h" |
43 | 42 | ||
44 | static int | ||
45 | cmsg_type_is_broken(void) | ||
46 | { | ||
47 | static int broken_cmsg_type = -1; | ||
48 | |||
49 | if (broken_cmsg_type != -1) | ||
50 | return broken_cmsg_type; | ||
51 | else { | ||
52 | struct utsname uts; | ||
53 | /* If uname() fails, play safe and assume that cmsg_type | ||
54 | * isn't broken. | ||
55 | */ | ||
56 | if (!uname(&uts) && | ||
57 | strcmp(uts.sysname, "Linux") == 0 && | ||
58 | strncmp(uts.release, "2.0.", 4) == 0) | ||
59 | broken_cmsg_type = 1; | ||
60 | else | ||
61 | broken_cmsg_type = 0; | ||
62 | } | ||
63 | |||
64 | return broken_cmsg_type; | ||
65 | } | ||
66 | |||
67 | int | 43 | int |
68 | mm_send_fd(int sock, int fd) | 44 | mm_send_fd(int sock, int fd) |
69 | { | 45 | { |
@@ -176,11 +152,13 @@ mm_receive_fd(int sock) | |||
176 | return -1; | 152 | return -1; |
177 | } | 153 | } |
178 | 154 | ||
179 | if (!cmsg_type_is_broken() && cmsg->cmsg_type != SCM_RIGHTS) { | 155 | #ifndef BROKEN_CMSG_TYPE |
156 | if (cmsg->cmsg_type != SCM_RIGHTS) { | ||
180 | error("%s: expected type %d got %d", __func__, | 157 | error("%s: expected type %d got %d", __func__, |
181 | SCM_RIGHTS, cmsg->cmsg_type); | 158 | SCM_RIGHTS, cmsg->cmsg_type); |
182 | return -1; | 159 | return -1; |
183 | } | 160 | } |
161 | #endif | ||
184 | fd = (*(int *)CMSG_DATA(cmsg)); | 162 | fd = (*(int *)CMSG_DATA(cmsg)); |
185 | #endif | 163 | #endif |
186 | return fd; | 164 | return fd; |