dbus/dbus dbus-transport-unix.c, 1.37, 1.38 dbus-message.c, 1.135, 1.136

Olivier Andrieu oandrieu at freedesktop.org
Thu Jul 29 01:00:47 PDT 2004


Update of /cvs/dbus/dbus/dbus
In directory pdx:/tmp/cvs-serv9454/dbus

Modified Files:
	dbus-transport-unix.c dbus-message.c 
Log Message:
* bus/config-loader-libxml.c: complete the implementation of libxml
backend for config file loader. Doesn't work with full OOM test yet.

* configure.in: change error when selecting libxml into a warning.

* test/data/invalid-config-files: add two non-well-formed XML files.

* glib/Makefile.am: libdbus_gtool always uses expat, not libxml.

* dbus/dbus-transport-unix.c (unix_handle_watch): do not disconnect in
case of DBUS_WATCH_HANGUP, several do_reading() may be necessary to
read all the buffer. (bug #894)

* bus/activation.c (bus_activation_activate_service): fix a potential
assertion failure (bug #896). Small optimization in the case of
auto-activation messages.

* dbus/dbus-message.c (verify_test_message, _dbus_message_test): add
test case for byte-through-vararg bug (#901). patch by Kimmo
Hämäläinen.


Index: dbus-transport-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-transport-unix.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- dbus-transport-unix.c	22 Jul 2004 07:07:00 -0000	1.37
+++ dbus-transport-unix.c	29 Jul 2004 08:00:45 -0000	1.38
@@ -717,11 +717,25 @@
   _dbus_assert (watch == unix_transport->read_watch ||
                 watch == unix_transport->write_watch);
   
+  /* Disconnect in case of an error.  In case of hangup do not
+   * disconnect the transport because data can still be in the buffer
+   * and do_reading may need several iteration to read it all (because
+   * of its max_bytes_read_per_iteration limit).  The condition where
+   * flags == HANGUP (without READABLE) probably never happen in fact.
+   */
+  if ((flags & DBUS_WATCH_ERROR) ||
+      ((flags & DBUS_WATCH_HANGUP) && !(flags & DBUS_WATCH_READABLE)))
+    {
+      _dbus_verbose ("Hang up or error on watch\n");
+      _dbus_transport_disconnect (transport);
+      return TRUE;
+    }
+  
   if (watch == unix_transport->read_watch &&
       (flags & DBUS_WATCH_READABLE))
     {
-#if 1
-      _dbus_verbose ("handling read watch\n");
+#if 0
+      _dbus_verbose ("handling read watch (%x)\n", flags);
 #endif
       if (!do_authentication (transport, TRUE, FALSE))
         return FALSE;
@@ -763,12 +777,6 @@
     }
 #endif /* DBUS_ENABLE_VERBOSE_MODE */
 
-  if (flags & (DBUS_WATCH_HANGUP | DBUS_WATCH_ERROR))
-    {
-      _dbus_transport_disconnect (transport);
-      return TRUE;
-    }
-  
   return TRUE;
 }
 

Index: dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- dbus-message.c	22 Jul 2004 07:07:01 -0000	1.135
+++ dbus-message.c	29 Jul 2004 08:00:45 -0000	1.136
@@ -2622,7 +2622,7 @@
 #endif /* DBUS_HAVE_INT64 */
 	case DBUS_TYPE_DOUBLE:
 	  {
-	    void *ptr = va_arg (var_args, void *);
+	    void *ptr = va_arg (var_args, double *);
 	    _dbus_message_iter_get_basic_type (iter, spec_type, ptr);
 	    break;
 	  }
@@ -6696,6 +6696,7 @@
   char *our_str;
   double our_double;
   dbus_bool_t our_bool;
+  unsigned char our_byte_1, our_byte_2;
   dbus_uint32_t our_uint32;
   dbus_int32_t *our_uint32_array;
   int our_uint32_array_len;
@@ -6730,6 +6731,9 @@
 				   DBUS_TYPE_STRING, &our_str,
 				   DBUS_TYPE_DOUBLE, &our_double,
 				   DBUS_TYPE_BOOLEAN, &our_bool,
+				   DBUS_TYPE_BYTE, &our_byte_1,
+				   DBUS_TYPE_BYTE, &our_byte_2,
+				   DBUS_TYPE_NIL,
 				   DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32,
                                    &our_uint32_array, &our_uint32_array_len,
                                    DBUS_TYPE_ARRAY, DBUS_TYPE_INT32,
@@ -6775,6 +6779,12 @@
   if (!our_bool)
     _dbus_assert_not_reached ("booleans differ");
 
+  if (our_byte_1 != 42)
+    _dbus_assert_not_reached ("bytes differ!");
+
+  if (our_byte_2 != 24)
+    _dbus_assert_not_reached ("bytes differ!");
+
   if (our_uint32_array_len != 4 ||
       our_uint32_array[0] != 0x12345678 ||
       our_uint32_array[1] != 0x23456781 ||
@@ -7027,6 +7037,9 @@
 			    DBUS_TYPE_STRING, "Test string",
 			    DBUS_TYPE_DOUBLE, 3.14159,
 			    DBUS_TYPE_BOOLEAN, TRUE,
+			    DBUS_TYPE_BYTE, (unsigned char) 42,
+			    DBUS_TYPE_BYTE, 24,
+			    DBUS_TYPE_NIL,
 			    DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, our_uint32_array,
                             _DBUS_N_ELEMENTS (our_uint32_array),
                             DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, our_int32_array,
@@ -7062,6 +7075,9 @@
   sig[i++] = DBUS_TYPE_STRING;
   sig[i++] = DBUS_TYPE_DOUBLE;
   sig[i++] = DBUS_TYPE_BOOLEAN;
+  sig[i++] = DBUS_TYPE_BYTE;
+  sig[i++] = DBUS_TYPE_BYTE;
+  sig[i++] = DBUS_TYPE_NIL;
   sig[i++] = DBUS_TYPE_ARRAY;
   sig[i++] = DBUS_TYPE_UINT32;
   sig[i++] = DBUS_TYPE_ARRAY;



More information about the dbus-commit mailing list