diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-11 05:21:42 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-12 01:19:18 +0900 |
commit | 7fb1d980aff8b035d96a34bd30efff261f3a5494 (patch) | |
tree | 9e421df1b8fabee1e55e2e9f186552ca9dbd8c90 /src/udev/udevadm-trigger.c | |
parent | bde8467a0de6fd2ec0a0738d9f3f0689ae5dd37f (diff) | |
download | systemd-7fb1d980aff8b035d96a34bd30efff261f3a5494.tar.gz |
tree-wide: propagate error in xxx_from-string()
Diffstat (limited to 'src/udev/udevadm-trigger.c')
-rw-r--r-- | src/udev/udevadm-trigger.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c index 7a9f968128..a4588cb4e4 100644 --- a/src/udev/udevadm-trigger.c +++ b/src/udev/udevadm-trigger.c @@ -210,16 +210,21 @@ int trigger_main(int argc, char *argv[], void *userdata) { else return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown type --type=%s", optarg); break; - case 'c': + case 'c': { + DeviceAction a; + if (streq(optarg, "help")) { dump_device_action_table(); return 0; } - if (device_action_from_string(optarg) < 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown action '%s'", optarg); + + a = device_action_from_string(optarg); + if (a < 0) + return log_error_errno(a, "Unknown action '%s'", optarg); action = optarg; break; + } case 's': r = sd_device_enumerator_add_match_subsystem(e, optarg, true); if (r < 0) |