summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-server-unix.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-06-04 05:20:20 +0000
committerHavoc Pennington <hp@redhat.com>2003-06-04 05:20:20 +0000
commita70b042f0dcebb10689975c65a2c45b52b7a4437 (patch)
tree46a45a6933e1f9fbf6ac30cc819e96f60536342f /dbus/dbus-server-unix.c
parent0e024fc53a5effadedd56427ffe261c417e45222 (diff)
2003-06-04 Havoc Pennington <hp@pobox.com>
* dbus/dbus-server.c (dbus_server_listen): allow abstract sockets using unix:abstract=/foo, and when listening in a tmpdir i.e. unix:tmpdir=/tmp, always use abstract sockets if we can. * dbus/dbus-transport.c (_dbus_transport_open): support unix:abstract=/foo * dbus/dbus-server-unix.c (_dbus_server_new_for_domain_socket): support abstract sockets * dbus/dbus-transport-unix.c (_dbus_transport_new_for_domain_socket): support abstract sockets * dbus/dbus-sysdeps.c (_dbus_connect_unix_socket): add "abstract" toggle as an argument, implement abstract namespace support (_dbus_listen_unix_socket): ditto * configure.in: add --enable-abstract-sockets and implement a configure check for autodetection of the right value.
Diffstat (limited to 'dbus/dbus-server-unix.c')
-rw-r--r--dbus/dbus-server-unix.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c
index fe4dbaa4..036446af 100644
--- a/dbus/dbus-server-unix.c
+++ b/dbus/dbus-server-unix.c
@@ -268,11 +268,13 @@ _dbus_server_new_for_fd (int fd,
* Creates a new server listening on the given Unix domain socket.
*
* @param path the path for the domain socket.
+ * @param abstract #TRUE to use abstract socket namespace
* @param error location to store reason for failure.
* @returns the new server, or #NULL on failure.
*/
DBusServer*
_dbus_server_new_for_domain_socket (const char *path,
+ dbus_bool_t abstract,
DBusError *error)
{
DBusServer *server;
@@ -289,7 +291,10 @@ _dbus_server_new_for_domain_socket (const char *path,
return NULL;
}
- if (!_dbus_string_append (&address, "unix:path=") ||
+ if ((abstract &&
+ !_dbus_string_append (&address, "unix:abstract=")) ||
+ (!abstract &&
+ !_dbus_string_append (&address, "unix:path=")) ||
!_dbus_string_append (&address, path))
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
@@ -303,7 +308,7 @@ _dbus_server_new_for_domain_socket (const char *path,
goto failed_0;
}
- listen_fd = _dbus_listen_unix_socket (path, error);
+ listen_fd = _dbus_listen_unix_socket (path, abstract, error);
_dbus_fd_set_close_on_exec (listen_fd);
if (listen_fd < 0)