From ff03bfa5080017bae850ec7f4ca5768f87bbd1e5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 10 Feb 2021 22:19:41 +0100 Subject: 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) --- src/udev/udevadm-test.c | 5 ++--- src/udev/udevadm-trigger.c | 2 +- 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': -- cgit v1.2.3