From 6d54407dbb089dd0b0d8d79189b029c4d82bae81 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 6 Apr 2003 18:27:23 +0000 Subject: 2003-04-06 Havoc Pennington * dbus/dbus-server-unix.c (_dbus_server_new_for_domain_socket): save the domain socket name, and unlink it when we disconnect the server. Means that at least when we exit normally, we won't leave a bunch of junk in /tmp * dbus/dbus-transport-unix.c (_dbus_transport_new_for_domain_socket): code cleanup (nicer memory management). (I was making a real change here but then didn't) --- dbus/dbus-transport-unix.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'dbus/dbus-transport-unix.c') diff --git a/dbus/dbus-transport-unix.c b/dbus/dbus-transport-unix.c index 5e37a007..d2bc6d7f 100644 --- a/dbus/dbus-transport-unix.c +++ b/dbus/dbus-transport-unix.c @@ -1045,21 +1045,21 @@ _dbus_transport_new_for_domain_socket (const char *path, dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); return NULL; } - + + fd = -1; + if (!_dbus_string_append (&address, "unix:path=") || !_dbus_string_append (&address, path)) { - _dbus_string_free (&address); dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); - return NULL; + goto failed_0; } fd = _dbus_connect_unix_socket (path, error); if (fd < 0) { _DBUS_ASSERT_ERROR_IS_SET (error); - _dbus_string_free (&address); - return NULL; + goto failed_0; } _dbus_fd_set_close_on_exec (fd); @@ -1071,14 +1071,18 @@ _dbus_transport_new_for_domain_socket (const char *path, if (transport == NULL) { dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); - _dbus_string_free (&address); - _dbus_close (fd, NULL); - fd = -1; + goto failed_1; } - + _dbus_string_free (&address); return transport; + + failed_1: + _dbus_close (fd, NULL); + failed_0: + _dbus_string_free (&address); + return NULL; } /** -- cgit