diff options
author | Chengwei Yang <chengwei.yang@intel.com> | 2013-09-12 13:38:10 +0800 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-09-13 13:40:08 +0100 |
commit | 200a11ebbee468fa08d1badab0046a93a75195ef (patch) | |
tree | 8dbae3e2830f23c9bbbf23c779880208d79dd88f | |
parent | c1288c5366f64b45280b4f8865e2efb716663ccd (diff) |
Check EINVAL for accept4()
It was reported that accept4() will return -1 with errrno is EINVAL on
arm platform, so check EINVAL for accept4() and retry accept().
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69026
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | dbus/dbus-sysdeps-unix.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 8405a429..92ce00ea 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1948,11 +1948,15 @@ _dbus_accept (int listen_fd) retry: #ifdef HAVE_ACCEPT4 - /* We assume that if accept4 is available SOCK_CLOEXEC is too */ + /* + * At compile-time, we assume that if accept4() is available in + * libc headers, SOCK_CLOEXEC is too. At runtime, it is still + * not necessarily true that either is supported by the running kernel. + */ client_fd = accept4 (listen_fd, &addr, &addrlen, SOCK_CLOEXEC); cloexec_done = client_fd >= 0; - if (client_fd < 0 && errno == ENOSYS) + if (client_fd < 0 && (errno == ENOSYS || errno == EINVAL)) #endif { client_fd = accept (listen_fd, &addr, &addrlen); |