summaryrefslogtreecommitdiff
path: root/src/udev/udevadm-trigger.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-03-07 14:43:33 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-03-07 15:19:02 +0900
commitdcee4a134c9e41a54b640bb7fdbb608c9826c792 (patch)
treea1deed94bb20d338fedbfdaca3fbeccea7eff18d /src/udev/udevadm-trigger.c
parent08caaee0ac6b1c7c2d89a699b44307cbb7440c10 (diff)
downloadsystemd-dcee4a134c9e41a54b640bb7fdbb608c9826c792.tar.gz
udevadm trigger: make --action option support all possible actions
This also make udevadm abort operations if invalid action is specified.
Diffstat (limited to 'src/udev/udevadm-trigger.c')
-rw-r--r--src/udev/udevadm-trigger.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index 63ceaaf957..b5e5f091ca 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -7,6 +7,7 @@
#include "sd-event.h"
#include "device-enumerator-private.h"
+#include "device-private.h"
#include "fd-util.h"
#include "fileio.h"
#include "path-util.h"
@@ -199,11 +200,10 @@ int trigger_main(int argc, char *argv[], void *userdata) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown type --type=%s", optarg);
break;
case 'c':
- if (STR_IN_SET(optarg, "add", "remove", "change"))
- action = optarg;
- else
- log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown action '%s'", optarg);
+ if (device_action_from_string(optarg) < 0)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown action '%s'", optarg);
+ action = optarg;
break;
case 's':
r = sd_device_enumerator_add_match_subsystem(e, optarg, true);