summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-transport-unix.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-25 04:37:08 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-25 04:37:08 +0000
commitce4fd314c6be9bfee16a172d5ca34e5097d309fc (patch)
tree744b8524f183a0fbb009d917029c9a129b34da9e /dbus/dbus-transport-unix.c
parent44fff656885ac32e319feb98fd0d06680d602977 (diff)
2003-03-24 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps.c (_dbus_set_fd_nonblocking): move to this file * dbus/dbus-errors.c (dbus_set_error, dbus_set_error_const): allow NULL argument for "message" if the error is a well-known one, fill in a generic message in this case. * dbus/dbus-errors.h (DBusResultCode): Kill DBusResultCode in favor of DBusError * bus/test.c (bus_test_flush_bus): add * bus/policy.c (bus_policy_test): test code stub
Diffstat (limited to 'dbus/dbus-transport-unix.c')
-rw-r--r--dbus/dbus-transport-unix.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/dbus/dbus-transport-unix.c b/dbus/dbus-transport-unix.c
index 5cbbb1f4..35eccb84 100644
--- a/dbus/dbus-transport-unix.c
+++ b/dbus/dbus-transport-unix.c
@@ -1028,20 +1028,25 @@ _dbus_transport_new_for_fd (int fd,
*
* @param path the path to the domain socket.
* @param server #TRUE if this transport is on the server side of a connection
- * @param result location to store reason for failure.
+ * @param error location to store reason for failure.
* @returns a new transport, or #NULL on failure.
*/
DBusTransport*
_dbus_transport_new_for_domain_socket (const char *path,
dbus_bool_t server,
- DBusResultCode *result)
+ DBusError *error)
{
int fd;
DBusTransport *transport;
- fd = _dbus_connect_unix_socket (path, result);
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ fd = _dbus_connect_unix_socket (path, error);
if (fd < 0)
- return NULL;
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ return NULL;
+ }
_dbus_fd_set_close_on_exec (fd);
@@ -1051,7 +1056,7 @@ _dbus_transport_new_for_domain_socket (const char *path,
transport = _dbus_transport_new_for_fd (fd, server);
if (transport == NULL)
{
- dbus_set_result (result, DBUS_RESULT_NO_MEMORY);
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
_dbus_close (fd, NULL);
fd = -1;
}
@@ -1072,14 +1077,19 @@ DBusTransport*
_dbus_transport_new_for_tcp_socket (const char *host,
dbus_int32_t port,
dbus_bool_t server,
- DBusResultCode *result)
+ DBusError *error)
{
int fd;
DBusTransport *transport;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
- fd = _dbus_connect_tcp_socket (host, port, result);
+ fd = _dbus_connect_tcp_socket (host, port, error);
if (fd < 0)
- return NULL;
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ return NULL;
+ }
_dbus_fd_set_close_on_exec (fd);
@@ -1089,7 +1099,7 @@ _dbus_transport_new_for_tcp_socket (const char *host,
transport = _dbus_transport_new_for_fd (fd, server);
if (transport == NULL)
{
- dbus_set_result (result, DBUS_RESULT_NO_MEMORY);
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
_dbus_close (fd, NULL);
fd = -1;
}