]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Check EINVAL for accept4()
authorChengwei Yang <chengwei.yang@intel.com>
Thu, 12 Sep 2013 05:38:10 +0000 (13:38 +0800)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 13 Sep 2013 12:40:08 +0000 (13:40 +0100)
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>
dbus/dbus-sysdeps-unix.c

index 8405a429d2421c5b356b0dd84754a6bc121d301b..92ce00eafabbf41925798a247fbe16102ea78577 100644 (file)
@@ -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);