From: Yu Watanabe Date: Sat, 9 Mar 2019 01:45:48 +0000 (+0900) Subject: login: use device_is_in_action() X-Git-Tag: v242-rc1~160^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=91bd2c349b67c1ad1bf79f6f0bec500882d92924;p=thirdparty%2Fsystemd.git login: use device_is_in_action() --- diff --git a/src/login/logind-core.c b/src/login/logind-core.c index 60831bb1c32..f3d8de4f143 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -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) diff --git a/src/login/logind.c b/src/login/logind.c index 95ec0a57c60..c78994aae66 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -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;