dbus/dbus dbus-sysdeps.c, 1.101, 1.102 dbus-transport-unix.c, 1.48,
1.49
Sjoerd Simons
sjoerd at kemper.freedesktop.org
Tue May 30 08:34:12 PDT 2006
Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv9728/dbus
Modified Files:
dbus-sysdeps.c dbus-transport-unix.c
Log Message:
* dbus/dbus-sysdeps.c: Make tcp socket connection error somewhat more
clear:
"Failed to connect to socket <host>:<port> <error>" instead of
"Failed to connect to socket <host>: <error>:<port>"
* dbus/dbus-transport-unix.c: Fix crash when no host option is given
for a tcp transport.
Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- dbus-sysdeps.c 24 Feb 2006 16:13:08 -0000 1.101
+++ dbus-sysdeps.c 30 May 2006 15:34:10 -0000 1.102
@@ -678,8 +678,8 @@
{
dbus_set_error (error,
_dbus_error_from_errno (errno),
- "Failed to connect to socket %s: %s:%d",
- host, _dbus_strerror (errno), port);
+ "Failed to connect to socket %s:%d %s",
+ host, port, _dbus_strerror (errno));
close (fd);
fd = -1;
Index: dbus-transport-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-transport-unix.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- dbus-transport-unix.c 25 Oct 2005 15:57:13 -0000 1.48
+++ dbus-transport-unix.c 30 May 2006 15:34:10 -0000 1.49
@@ -1272,16 +1272,18 @@
return NULL;
}
- if (!_dbus_string_append (&address, "tcp:host=") ||
- !_dbus_string_append (&address, host) ||
- !_dbus_string_append (&address, ",port=") ||
+ if (!_dbus_string_append (&address, "tcp:"))
+ goto error;
+
+ if (host != NULL &&
+ (!_dbus_string_append (&address, "host=") ||
+ !_dbus_string_append (&address, host)))
+ goto error;
+
+ if (!_dbus_string_append (&address, ",port=") ||
!_dbus_string_append_int (&address, port))
- {
- _dbus_string_free (&address);
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- return NULL;
- }
-
+ goto error;
+
fd = _dbus_connect_tcp_socket (host, port, error);
if (fd < 0)
{
@@ -1307,6 +1309,11 @@
_dbus_string_free (&address);
return transport;
+
+error:
+ _dbus_string_free (&address);
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ return NULL;
}
/** @} */
More information about the dbus-commit
mailing list