--- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1617,6 +1627,12 @@ if (bytes_written < 0 && errno == EINTR) goto again; + /* sendmsg() only accepts domain == PF_UNIX*/ +#if defined(HAVE_CMSGCRED) + if (bytes_written < 0 && errno == EINVAL) + bytes_written = send (server_fd, buf, 1, 0); +#endif + if (bytes_written < 0) { dbus_set_error (error, _dbus_error_from_errno (errno), @@ -1753,8 +1769,12 @@ } #if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS) - if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof (struct cmsgcred)) - || cmsg.hdr.cmsg_type != SCM_CREDS) + /* Special case for a zero credentials byte written */ + if (bytes_read == 1 && buf == '\0') + { + } + else if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof (struct cmsgcred)) + || cmsg.hdr.cmsg_type != SCM_CREDS) { dbus_set_error (error, DBUS_ERROR_FAILED, "Message from recvmsg() was not SCM_CREDS");