diff options
author | Pekka Paalanen <ppaalanen@gmail.com> | 2012-04-23 12:10:45 +0300 |
---|---|---|
committer | Pekka Paalanen <ppaalanen@gmail.com> | 2012-04-25 09:32:57 +0300 |
commit | 3b29783dc8f0e856afce7a9edf10c0ca4d12f284 (patch) | |
tree | 9f5e1bc98cadea11f2a5ed1f2fb6b488acd61443 /tests | |
parent | 1f827a477607d0a9dc9520fc6c53c936befb663d (diff) |
os: define SOCK_CLOEXEC on Linux
If it's not already defined, and we are on Linux, #define it. This gets
rid of a load of #ifdefs. This should also allow to use it when the
kernel supports it, but the libc does not define it.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/os-wrappers-test.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/tests/os-wrappers-test.c b/tests/os-wrappers-test.c index aa2631b..c6bf26e 100644 --- a/tests/os-wrappers-test.c +++ b/tests/os-wrappers-test.c @@ -50,12 +50,10 @@ socket(int domain, int type, int protocol) { wrapped_calls++; -#ifdef SOCK_CLOEXEC if (fall_back && (type & SOCK_CLOEXEC)) { errno = EINVAL; return -1; } -#endif return real_socket(domain, type, protocol); } @@ -70,17 +68,13 @@ do_os_wrappers_socket_cloexec(int n) /* simply create a socket that closes on exec */ fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0); + assert(fd >= 0); -#ifdef SOCK_CLOEXEC /* * Must have 2 calls if falling back, but must also allow * falling back without a forced fallback. */ assert(wrapped_calls > n); -#else - assert(wrapped_calls == 1); -#endif - assert(fd >= 0); exec_fd_leak_check(nr_fds); } |