summaryrefslogtreecommitdiffstats
path: root/src/udev
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-02-10 22:19:41 +0100
committerLennart Poettering <lennart@poettering.net>2021-02-18 18:21:25 +0100
commitff03bfa5080017bae850ec7f4ca5768f87bbd1e5 (patch)
tree5b92780cbb28540733aab07ce8798325865d54be /src/udev
parentsd-device: add sd_device_get_action() + sd_device_get_seqnum() + sd_device_ne... (diff)
downloadsystemd-ff03bfa5080017bae850ec7f4ca5768f87bbd1e5.tar.xz
systemd-ff03bfa5080017bae850ec7f4ca5768f87bbd1e5.zip
udevadm: after validating action, use our internal string instead of optarg
This doesn't really change anything, but feels nicer, since it abstracts away what device_action_from_string()/device_action_to_string() do internally, and always uses a normalized action string (yes, there's no ambiguity, but it's nice to stay abstract, maybe one day there is ambiguity around this)
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udevadm-test.c5
-rw-r--r--src/udev/udevadm-trigger.c2
2 files changed, 3 insertions, 4 deletions
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index bbee79c88e..7a30e25135 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -63,10 +63,9 @@ static int parse_argv(int argc, char *argv[]) {
a = device_action_from_string(optarg);
if (a < 0)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "Invalid action '%s'", optarg);
+ return log_error_errno(a, "Invalid action '%s'", optarg);
- arg_action = optarg;
+ arg_action = device_action_to_string(a);
break;
}
case 'N':
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index 908c27495f..2d16f34d86 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -222,7 +222,7 @@ int trigger_main(int argc, char *argv[], void *userdata) {
if (a < 0)
return log_error_errno(a, "Unknown action '%s'", optarg);
- action = optarg;
+ action = device_action_to_string(a);
break;
}
case 's':