diff options
author | Havoc Pennington <hp@redhat.com> | 2003-04-06 18:27:23 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-04-06 18:27:23 +0000 |
commit | 6d54407dbb089dd0b0d8d79189b029c4d82bae81 (patch) | |
tree | fb8d1dfceca88d7c63347ab82bb53de6869e5266 /dbus/dbus-transport-unix.c | |
parent | e45e4382274149ca60c11f068ccca719f3598074 (diff) |
2003-04-06 Havoc Pennington <hp@pobox.com>
* 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)
Diffstat (limited to 'dbus/dbus-transport-unix.c')
-rw-r--r-- | dbus/dbus-transport-unix.c | 22 |
1 files changed, 13 insertions, 9 deletions
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; } /** |