]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udevadm: after validating action, use our internal string instead of optarg 18546/head
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Feb 2021 21:19:41 +0000 (22:19 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Feb 2021 17:21:25 +0000 (18:21 +0100)
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
src/udev/udevadm-trigger.c

index bbee79c88e222094dcadb5c9e327940786be1611..7a30e25135c5dad6976b8d4cc2d59bda7115a19c 100644 (file)
@@ -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':
index 908c27495f8da95d000572927a03ba2e1cda21a3..2d16f34d8644ce01d1fa4261cc6c1d1a6bf20a31 100644 (file)
@@ -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':