chiark / gitweb /
shared: in code that might get called from suid programs use __secure_getenv() rather...
[elogind.git] / src / shared / dbus-common.c
index 7f0dce5ad393eda0b6292f3e3d793390ffa09a26..8d7c4620cebac95f7f97e3858f99447ab9ef4a30 100644 (file)
@@ -121,7 +121,7 @@ int bus_connect(DBusBusType t, DBusConnection **_bus, bool *_private, DBusError
                          * try via XDG_RUNTIME_DIR first, then
                          * fallback to normal bus access */
 
-                        e = getenv("XDG_RUNTIME_DIR");
+                        e = __secure_getenv("XDG_RUNTIME_DIR");
                         if (e) {
                                 char *p;
 
@@ -1287,7 +1287,8 @@ int bus_method_call_with_reply(DBusConnection *bus,
         reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error);
         dbus_message_unref(m);
         if (!reply) {
-                log_error("Failed to issue method call: %s", bus_error_message(&error));
+                if (!return_error)
+                        log_error("Failed to issue method call: %s", bus_error_message(&error));
                 if (bus_error_is_no_service(&error))
                         r = -ENOENT;
                 else if (dbus_error_has_name(&error, DBUS_ERROR_ACCESS_DENIED))