diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-07 14:43:33 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-07 15:19:02 +0900 |
commit | dcee4a134c9e41a54b640bb7fdbb608c9826c792 (patch) | |
tree | a1deed94bb20d338fedbfdaca3fbeccea7eff18d /src/udev/udevadm-trigger.c | |
parent | 08caaee0ac6b1c7c2d89a699b44307cbb7440c10 (diff) | |
download | systemd-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.c | 8 |
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); |