mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-03-15 20:50:38 +01:00
If sendmsg() with SCM_CREDS fails with EINVAL, retry with send()
Perhaps some OSs accept and ignore attempts to send a SCM_CREDS message on a non-Unix socket, but GNU/kFreeBSD doesn't (and presumably FreeBSD doesn't either). Based on a patch by Svante Signell. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69492 Tested-by: Svante Signell Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
This commit is contained in:
parent
4e8032be4e
commit
3ca8a53e33
1 changed files with 11 additions and 5 deletions
|
|
@ -1572,13 +1572,19 @@ write_credentials_byte (int server_fd,
|
|||
|MSG_NOSIGNAL
|
||||
#endif
|
||||
);
|
||||
#else
|
||||
bytes_written = send (server_fd, buf, 1, 0
|
||||
|
||||
/* If we HAVE_CMSGCRED, the OS still might not let us sendmsg()
|
||||
* with a SOL_SOCKET/SCM_CREDS message - for instance, FreeBSD
|
||||
* only allows that on AF_UNIX. Try just doing a send() instead. */
|
||||
if (bytes_written < 0 && errno == EINVAL)
|
||||
#endif
|
||||
{
|
||||
bytes_written = send (server_fd, buf, 1, 0
|
||||
#if HAVE_DECL_MSG_NOSIGNAL
|
||||
|MSG_NOSIGNAL
|
||||
#endif
|
||||
);
|
||||
|MSG_NOSIGNAL
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
if (bytes_written < 0 && errno == EINTR)
|
||||
goto again;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue