]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
_dbus_listen_unix_socket: don't try to set SO_REUSEADDR
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 1 Nov 2013 13:51:13 +0000 (13:51 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 6 Jan 2014 15:55:42 +0000 (15:55 +0000)
On Hurd, the setsockopt() fails. Svante Signell confirmed that on
at least Linux and kFreeBSD, SO_REUSEADDR "succeeds" on Unix sockets,
but doesn't have any practical effect; so rather than making the
failure not issue a warning, we might as well not bother with the
syscall at all.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69492
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
dbus/dbus-sysdeps-unix.c

index 6fd1b764b61a162470c77a4ae4806f3ce73e553d..ae42f56e398b6625477c6dbcb04c6cbbf18ce9da 100644 (file)
@@ -999,7 +999,6 @@ _dbus_listen_unix_socket (const char     *path,
   int listen_fd;
   struct sockaddr_un addr;
   size_t path_len;
-  unsigned int reuseaddr;
 
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
 
@@ -1074,13 +1073,6 @@ _dbus_listen_unix_socket (const char     *path,
       strncpy (addr.sun_path, path, path_len);
     }
 
-  reuseaddr = 1;
-  if (setsockopt  (listen_fd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(reuseaddr))==-1)
-    {
-      _dbus_warn ("Failed to set socket option\"%s\": %s",
-                  path, _dbus_strerror (errno));
-    }
-
   if (bind (listen_fd, (struct sockaddr*) &addr, _DBUS_STRUCT_OFFSET (struct sockaddr_un, sun_path) + path_len) < 0)
     {
       dbus_set_error (error, _dbus_error_from_errno (errno),