chiark / gitweb /
machined: ignore spurious error
[elogind.git] / src / login / logind-dbus.c
index acef5119b16b590b2998fcf8d8fd06daaac792a0..bbb4ae2de66a912168a68bf5c658551f4f95c815 100644 (file)
@@ -23,7 +23,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <pwd.h>
-#include <sys/capability.h>
 
 #include "sd-id128.h"
 #include "sd-messages.h"
 #include "audit.h"
 #include "bus-util.h"
 #include "bus-error.h"
-#include "logind.h"
-#include "bus-errors.h"
+#include "bus-common-errors.h"
 #include "udev-util.h"
+#include "selinux-util.h"
+#include "logind.h"
 
 static int property_get_idle_hint(
                 sd_bus *bus,
@@ -727,7 +727,7 @@ static int method_create_session(sd_bus *bus, sd_bus_message *message, void *use
 
         /* Now, let's wait until the slice unit and stuff got
          * created. We send the reply back from
-         * session_send_create_reply().*/
+         * session_send_create_reply(). */
 
         return 1;
 
@@ -1143,7 +1143,7 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
                 return -ENOMEM;
 
         mkdir_p_label("/etc/udev/rules.d", 0755);
-        label_init("/etc");
+        mac_selinux_init("/etc");
         r = write_string_file_atomic_label(file, rule);
         if (r < 0)
                 return r;
@@ -1159,7 +1159,7 @@ static int flush_devices(Manager *m) {
         d = opendir("/etc/udev/rules.d");
         if (!d) {
                 if (errno != ENOENT)
-                        log_warning("Failed to open /etc/udev/rules.d: %m");
+                        log_warning_errno(errno, "Failed to open /etc/udev/rules.d: %m");
         } else {
                 struct dirent *de;
 
@@ -1175,7 +1175,7 @@ static int flush_devices(Manager *m) {
                                 continue;
 
                         if (unlinkat(dirfd(d), de->d_name, 0) < 0)
-                                log_warning("Failed to unlink %s: %m", de->d_name);
+                                log_warning_errno(errno, "Failed to unlink %s: %m", de->d_name);
                 }
         }
 
@@ -1300,9 +1300,11 @@ static int bus_manager_log_shutdown(
                 q = NULL;
         }
 
-        return log_struct(LOG_NOTICE, MESSAGE_ID(SD_MESSAGE_SHUTDOWN),
+        return log_struct(LOG_NOTICE,
+                          LOG_MESSAGE_ID(SD_MESSAGE_SHUTDOWN),
                           p,
-                          q, NULL);
+                          q,
+                          NULL);
 }
 
 static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) {
@@ -1919,6 +1921,7 @@ const sd_bus_vtable manager_vtable[] = {
         SD_BUS_PROPERTY("HandleSuspendKey", "s", property_get_handle_action, offsetof(Manager, handle_suspend_key), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("HandleHibernateKey", "s", property_get_handle_action, offsetof(Manager, handle_hibernate_key), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("HandleLidSwitch", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch), SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("HandleLidSwitchDocked", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch_docked), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("IdleAction", "s", property_get_handle_action, offsetof(Manager, idle_action), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("IdleActionUSec", "t", NULL, offsetof(Manager, idle_action_usec), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("PreparingForShutdown", "b", property_get_preparing, 0, 0),
@@ -2108,9 +2111,10 @@ int match_properties_changed(sd_bus *bus, sd_bus_message *message, void *userdat
                 return 0;
 
         r = unit_name_from_dbus_path(path, &unit);
+        if (r == -EINVAL) /* not a unit */
+                return 0;
         if (r < 0)
-                /* quietly ignore non-units paths */
-                return r == -EINVAL ? 0 : r;
+                return r;
 
         session = hashmap_get(m->session_units, unit);
         if (session)