chiark / gitweb /
license: add GPLv2+ license blurbs everwhere
[elogind.git] / dbus.c
diff --git a/dbus.c b/dbus.c
index 17987210e6b2067d683959825dda8a5b31da03ec..24d16a67721b0a9270f1d9e7a89fc633fc92a1de 100644 (file)
--- a/dbus.c
+++ b/dbus.c
@@ -1,5 +1,24 @@
 /*-*- Mode: C; c-basic-offset: 8 -*-*/
 
+/***
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
 #include <dbus/dbus.h>
 
 #include <sys/epoll.h>
@@ -436,7 +455,7 @@ DBusHandlerResult bus_default_message_handler(Manager *m, DBusMessage *message,
                         if (!streq(p->interface, interface))
                                 continue;
 
-                        if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, "sv" , &sub2) ||
+                        if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, NULL, &sub2) ||
                             !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &p->property) ||
                             !dbus_message_iter_open_container(&sub2, DBUS_TYPE_VARIANT, p->signature, &sub3))
                                 goto oom;
@@ -561,7 +580,9 @@ int bus_property_append_string(Manager *m, DBusMessageIter *i, const char *prope
         assert(m);
         assert(i);
         assert(property);
-        assert(t);
+
+        if (!t)
+                t = "";
 
         if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t))
                 return -ENOMEM;
@@ -606,3 +627,27 @@ int bus_property_append_bool(Manager *m, DBusMessageIter *i, const char *propert
 
         return 0;
 }
+
+int bus_property_append_uint64(Manager *m, DBusMessageIter *i, const char *property, void *data) {
+        assert(m);
+        assert(i);
+        assert(property);
+        assert(data);
+
+        if (!dbus_message_iter_append_basic(i, DBUS_TYPE_UINT64, data))
+                return -ENOMEM;
+
+        return 0;
+}
+
+int bus_property_append_uint32(Manager *m, DBusMessageIter *i, const char *property, void *data) {
+        assert(m);
+        assert(i);
+        assert(property);
+        assert(data);
+
+        if (!dbus_message_iter_append_basic(i, DBUS_TYPE_UINT32, data))
+                return -ENOMEM;
+
+        return 0;
+}