From b1e3bf379e455c4c1e54acb3add9ae186b244c81 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 1 Nov 2013 13:51:13 +0000 Subject: [PATCH] _dbus_listen_unix_socket: don't try to set SO_REUSEADDR 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. --- dbus/dbus-sysdeps-unix.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 0708004..15b94fa 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -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), -- 1.8.4.2