]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
login: use device_is_in_action()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 9 Mar 2019 01:45:48 +0000 (10:45 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 11 Mar 2019 18:49:53 +0000 (03:49 +0900)
src/login/logind-core.c
src/login/logind.c

index 60831bb1c327b463e79cb7f1b70fbbf58e08d3aa..f3d8de4f143f4b3dd54c71574e0dbd3b5087aba7 100644 (file)
@@ -24,6 +24,7 @@
 #include "process-util.h"
 #include "strv.h"
 #include "terminal-util.h"
+#include "udev-util.h"
 #include "user-util.h"
 
 void manager_reset_config(Manager *m) {
@@ -238,14 +239,12 @@ int manager_add_button(Manager *m, const char *name, Button **_button) {
 }
 
 int manager_process_seat_device(Manager *m, sd_device *d) {
-        const char *action;
         Device *device;
         int r;
 
         assert(m);
 
-        if (sd_device_get_property_value(d, "ACTION", &action) >= 0 &&
-            streq(action, "remove")) {
+        if (device_for_action(d, DEVICE_ACTION_REMOVE)) {
                 const char *syspath;
 
                 r = sd_device_get_syspath(d, &syspath);
@@ -305,7 +304,7 @@ int manager_process_seat_device(Manager *m, sd_device *d) {
 }
 
 int manager_process_button_device(Manager *m, sd_device *d) {
-        const char *action, *sysname;
+        const char *sysname;
         Button *b;
         int r;
 
@@ -315,8 +314,7 @@ int manager_process_button_device(Manager *m, sd_device *d) {
         if (r < 0)
                 return r;
 
-        if (sd_device_get_property_value(d, "ACTION", &action) >= 0 &&
-            streq(action, "remove")) {
+        if (device_for_action(d, DEVICE_ACTION_REMOVE)) {
 
                 b = hashmap_get(m->buttons, sysname);
                 if (!b)
index 95ec0a57c600c10214840f68c234495c4b6b39cf..c78994aae669770a229dc7a90f0f0cb90ecc97a4 100644 (file)
@@ -26,6 +26,7 @@
 #include "signal-util.h"
 #include "strv.h"
 #include "terminal-util.h"
+#include "udev-util.h"
 
 static Manager* manager_unref(Manager *m);
 DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_unref);
@@ -559,7 +560,7 @@ static int manager_dispatch_device_udev(sd_device_monitor *monitor, sd_device *d
 
 static int manager_dispatch_vcsa_udev(sd_device_monitor *monitor, sd_device *device, void *userdata) {
         Manager *m = userdata;
-        const char *name, *action;
+        const char *name;
 
         assert(m);
         assert(device);
@@ -569,8 +570,7 @@ static int manager_dispatch_vcsa_udev(sd_device_monitor *monitor, sd_device *dev
 
         if (sd_device_get_sysname(device, &name) >= 0 &&
             startswith(name, "vcsa") &&
-            sd_device_get_property_value(device, "ACTION", &action) >= 0 &&
-            streq(action, "remove"))
+            device_for_action(device, DEVICE_ACTION_REMOVE))
                 seat_preallocate_vts(m->seat0);
 
         return 0;