Commit ca99f014 authored by Simon McVittie's avatar Simon McVittie

Merge branch 'dbus-1.6'

Conflicts:
	NEWS
	configure.ac
parents dd71688e 1c95955c
......@@ -45,6 +45,13 @@ Enhancements:
Fixes:
• Avoid an infinite busy-loop if a signal interrupts waitpid()
(fd.o #68945, Simon McVittie)
• Make dbus_connection_set_route_peer_messages(x, FALSE) behave as
documented. Previously, it assumed its second parameter was TRUE.
(fd.o #69165, Chengwei Yang)
• Escape addresses containing non-ASCII characters correctly
(fd.o #53499, Chengwei Yang)
......@@ -73,6 +80,14 @@ Fixes:
• Make "make -j check" work (fd.o #68852, Simon McVittie)
• Unix-specific:
· If accept4() fails with EINVAL, as it can on older Linux kernels
with newer glibc, try accept() instead of going into a busy-loop.
(fd.o #69026, Chengwei Yang)
· If socket() or socketpair() fails with EINVAL or EPROTOTYPE,
for instance on Hurd or older Linux with a new glibc, try without
SOCK_CLOEXEC. (fd.o #69073; Pino Toscano, Chengwei Yang)
· Fix a file descriptor leak on an error code path.
(fd.o #69182, Sviatoslav Chagaev)
· dbus-run-session: clear some unwanted environment variables
(fd.o #39196, Simon)
· dbus-run-session: compile on FreeBSD (fd.o #66197, Chengwei Yang)
......
......@@ -5455,7 +5455,7 @@ dbus_connection_set_route_peer_messages (DBusConnection *connection,
_dbus_return_if_fail (connection != NULL);
CONNECTION_LOCK (connection);
connection->route_peer_messages = TRUE;
connection->route_peer_messages = value;
CONNECTION_UNLOCK (connection);
}
......
......@@ -308,15 +308,18 @@ _dbus_babysitter_unref (DBusBabysitter *sitter)
if (ret == 0)
kill (sitter->sitter_pid, SIGKILL);
again:
if (ret == 0)
ret = waitpid (sitter->sitter_pid, &status, 0);
{
do
{
ret = waitpid (sitter->sitter_pid, &status, 0);
}
while (_DBUS_UNLIKELY (ret < 0 && errno == EINTR));
}
if (ret < 0)
{
if (errno == EINTR)
goto again;
else if (errno == ECHILD)
if (errno == ECHILD)
_dbus_warn ("Babysitter process not available to be reaped; should not happen\n");
else
_dbus_warn ("Unexpected error %d in waitpid() for babysitter: %s\n",
......
......@@ -144,7 +144,7 @@ _dbus_open_socket (int *fd_p,
cloexec_done = *fd_p >= 0;
/* Check if kernel seems to be too old to know SOCK_CLOEXEC */
if (*fd_p < 0 && errno == EINVAL)
if (*fd_p < 0 && (errno == EINVAL || errno == EPROTOTYPE))
#endif
{
*fd_p = socket (domain, type, protocol);
......@@ -892,16 +892,24 @@ _dbus_connect_exec (const char *path,
{
int fds[2];
pid_t pid;
int retval;
dbus_bool_t cloexec_done = 0;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
_dbus_verbose ("connecting to process %s\n", path);
if (socketpair (AF_UNIX, SOCK_STREAM
#ifdef SOCK_CLOEXEC
|SOCK_CLOEXEC
retval = socketpair (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds);
cloexec_done = (retval >= 0);
if (retval < 0 && (errno == EINVAL || errno == EPROTOTYPE))
#endif
, 0, fds) < 0)
{
retval = socketpair (AF_UNIX, SOCK_STREAM, 0, fds);
}
if (retval < 0)
{
dbus_set_error (error,
_dbus_error_from_errno (errno),
......@@ -910,8 +918,11 @@ _dbus_connect_exec (const char *path,
return -1;
}
_dbus_fd_set_close_on_exec (fds[0]);
_dbus_fd_set_close_on_exec (fds[1]);
if (!cloexec_done)
{
_dbus_fd_set_close_on_exec (fds[0]);
_dbus_fd_set_close_on_exec (fds[1]);
}
pid = fork ();
if (pid < 0)
......@@ -1942,11 +1953,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);
......@@ -3070,7 +3085,7 @@ _dbus_full_duplex_pipe (int *fd1,
retval = socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds);
cloexec_done = retval >= 0;
if (retval < 0 && errno == EINVAL)
if (retval < 0 && (errno == EINVAL || errno == EPROTOTYPE))
#endif
{
retval = socketpair(AF_UNIX, SOCK_STREAM, 0, fds);
......
......@@ -1157,6 +1157,7 @@ _dbus_command_for_pid (unsigned long pid,
"Failed to read from \"%s\": %s",
_dbus_string_get_const_data (&path),
_dbus_strerror (errno));
_dbus_close (fd, NULL);
goto fail;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment