From b8a021c9e276adc9bed5ebfa39c3cab0077113c6 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Wed, 9 Mar 2011 20:03:29 +0100 Subject: [PATCH] dbus: fix dbus assert due to uninitialized error Add missing dbus_error_init() in UNKNOWN_OBJECT case. Fixes assertion systemd[1]: Caught , dumped core as pid 6256. systemd[1]: Freezing execution. Core was generated by `/bin/systemd systemd.unit=graphical.target'. Program terminated with signal 6, Aborted. #0 0x00007f8966ec81db in raise () from /lib64/libpthread.so.0 (gdb) bt #0 0x00007f8966ec81db in raise () from /lib64/libpthread.so.0 #1 0x000000000040823b in crash (sig=6) at src/main.c:120 #2 #3 0x00007f896613c075 in raise () from /lib64/libc.so.6 #4 0x00007f896613d806 in abort () from /lib64/libc.so.6 #5 0x00007f89672ac8a5 in _dbus_abort () at dbus-sysdeps.c:94 #6 0x00007f89672a37b5 in _dbus_warn_check_failed ( format=0x7f89672b35d8 "arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\nThis is normally a bug in some application using the D-Bus library.\n") at dbus-internals.c:289 #7 0x0000000000441500 in bus_unit_message_handler (connection=0x21b6090, message=0x21b6760, data=0x1f3e870) at src/dbus-unit.c:572 #8 0x00007f8967299f11 in _dbus_object_tree_dispatch_and_unlock ( tree=0x219d660, message=0x21b6760) at dbus-object-tree.c:858 #9 0x00007f896728bca2 in dbus_connection_dispatch (connection=0x21b6090) at dbus-connection.c:4688 #10 0x000000000043befa in bus_dispatch (m=0x1f3e870) at src/dbus.c:547 #11 0x000000000041056d in manager_loop (m=0x1f3e870) at src/manager.c:2344 #12 0x0000000000409515 in main (argc=, argv=) at src/main.c:1229 --- src/dbus-job.c | 2 ++ src/dbus-unit.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/dbus-job.c b/src/dbus-job.c index b66d2360..908ddba5 100644 --- a/src/dbus-job.c +++ b/src/dbus-job.c @@ -198,6 +198,8 @@ static DBusHandlerResult bus_job_message_handler(DBusConnection *connection, DBu if (r == -ENOENT) { DBusError e; + + dbus_error_init(&e); dbus_set_error_const(&e, DBUS_ERROR_UNKNOWN_OBJECT, "Unknown job"); return bus_send_error_reply(m, connection, message, &e, r); } diff --git a/src/dbus-unit.c b/src/dbus-unit.c index 52e8599e..563ef707 100644 --- a/src/dbus-unit.c +++ b/src/dbus-unit.c @@ -568,6 +568,8 @@ static DBusHandlerResult bus_unit_message_handler(DBusConnection *connection, DB if (r == -ENOENT) { DBusError e; + + dbus_error_init(&e); dbus_set_error_const(&e, DBUS_ERROR_UNKNOWN_OBJECT, "Unknown unit"); return bus_send_error_reply(m, connection, message, &e, r); } -- 2.39.5