[PATCH] Misc. fixes (me too)

Olivier Andrieu oliv__a at users.sourceforge.net
Thu Apr 22 04:04:09 EST 2004


Hi,

The attatched patch fixes a couple of small things:

 - the bug reported by Mahir: failed assertion by the bus when
   overwriting the sender field,

 - some failed assertions by the bus when bus_context_new() aborts (eg
   because of a problem in the config file),

 - the build issue in the tools/ directory reported by Ilja.

-- 
   Olivier
-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /cvs/dbus/dbus/ChangeLog,v
retrieving revision 1.474
diff -u -u -p -r1.474 ChangeLog
--- a/ChangeLog	19 Apr 2004 22:09:55 -0000	1.474
+++ b/ChangeLog	21 Apr 2004 17:47:13 -0000
@@ -1,3 +1,16 @@
+2004-04-21  Olivier Andrieu  <oliv__a at users.sourceforge.net>
+
+	* dbus/dbus-message.c (decode_header_data, decode_string_field):
+	fix incorrect setting of .name_offset in the HeaderField (it was
+	off by two bytes, positioned right after the name and typecode)
+
+	* bus/bus.c (bus_context_new, bus_context_unref): test before
+	calling dbus_server_free_data_slot and _dbus_user_database_unref
+	in case of an error.
+
+	* tools/Makefile.am: add $(DBUS_GLIB_TOOL_LIBS), xml libs needed
+	by libdbus-gtool.
+
 2004-04-19  Kristian H?gsberg  <krh at redhat.com>
 
 	* dbus/dbus-transport-unix.c (unix_do_iteration): Rewrite to use
Index: dbus/dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.125
diff -u -u -p -r1.125 dbus-message.c
--- a/dbus/dbus-message.c	29 Mar 2004 13:11:05 -0000	1.125
+++ b/dbus/dbus-message.c	21 Apr 2004 17:47:14 -0000
@@ -5018,7 +5018,7 @@ decode_string_field (const DBusString   
   _dbus_string_init_const (field_data,
                            _dbus_string_get_const_data (data) + string_data_pos);
 
-  header_field->name_offset  = pos;
+  header_field->name_offset  = pos - 2;
   header_field->value_offset = _DBUS_ALIGN_VALUE (pos, 4);
   
 #if 0
@@ -5188,7 +5188,7 @@ decode_header_data (const DBusString   *
               return FALSE;
             }
 
-          fields[field].name_offset  = pos;
+          fields[field].name_offset  = pos - 2;
           fields[field].value_offset = _DBUS_ALIGN_VALUE (pos, 4);
 
           /* No forging signals from the local path */
@@ -5222,7 +5222,7 @@ decode_header_data (const DBusString   *
               return FALSE;
             }
           
-          fields[field].name_offset  = pos;
+          fields[field].name_offset  = pos - 2;
           fields[field].value_offset = _DBUS_ALIGN_VALUE (pos, 4);
 
           _dbus_verbose ("Found reply serial %u at offset %d\n",
Index: bus/bus.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/bus.c,v
retrieving revision 1.50
diff -u -u -p -r1.50 bus.c
--- a/bus/bus.c	16 Apr 2004 15:01:25 -0000	1.50
+++ b/bus/bus.c	21 Apr 2004 17:47:14 -0000
@@ -753,7 +753,8 @@ bus_context_new (const DBusString *confi
   if (context != NULL)
     bus_context_unref (context);
 
-  dbus_server_free_data_slot (&server_data_slot);
+  if (server_data_slot >= 0)
+    dbus_server_free_data_slot (&server_data_slot);
   
   return NULL;
 }
@@ -890,7 +891,8 @@ bus_context_unref (BusContext *context)
           dbus_free (context->pidfile); 
 	}
 
-      _dbus_user_database_unref (context->user_database);
+      if (context->user_database != NULL)
+	_dbus_user_database_unref (context->user_database);
       
       dbus_free (context);
 
Index: tools/Makefile.am
===================================================================
RCS file: /cvs/dbus/dbus/tools/Makefile.am,v
retrieving revision 1.8
diff -u -u -p -r1.8 Makefile.am
--- a/tools/Makefile.am	30 Sep 2003 02:33:11 -0000	1.8
+++ b/tools/Makefile.am	21 Apr 2004 17:47:14 -0000
@@ -38,7 +38,7 @@ dbus_viewer_SOURCES=				\
 dbus_send_LDADD= $(top_builddir)/dbus/libdbus-1.la
 dbus_monitor_LDADD= $(top_builddir)/glib/libdbus-glib-1.la
 dbus_launch_LDADD= $(DBUS_X_LIBS)
-dbus_viewer_LDADD= $(top_builddir)/glib/libdbus-gtool.la $(DBUS_GTK_LIBS)
+dbus_viewer_LDADD= $(DBUS_GLIB_TOOL_LIBS) $(top_builddir)/glib/libdbus-gtool.la $(DBUS_GTK_LIBS)
 
 man_MANS = dbus-send.1 dbus-monitor.1 dbus-launch.1 dbus-cleanup-sockets.1
 EXTRA_DIST = $(man_MANS)


More information about the dbus mailing list