mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
udev: use parse_sec() to parse --event-timeout option
This commit is contained in:
parent
389f9bf2cf
commit
9d9264ba39
@ -1461,11 +1461,9 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
||||
if (proc_cmdline_value_missing(key, value))
|
||||
return 0;
|
||||
|
||||
r = safe_atou64(value, &arg_event_timeout_usec);
|
||||
if (r >= 0) {
|
||||
arg_event_timeout_usec *= USEC_PER_SEC;
|
||||
arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1;
|
||||
}
|
||||
r = parse_sec(value, &arg_event_timeout_usec);
|
||||
if (r >= 0)
|
||||
arg_event_timeout_warn_usec = DIV_ROUND_UP(arg_event_timeout_usec, 3);
|
||||
|
||||
} else if (proc_cmdline_key_streq(key, "udev.children_max")) {
|
||||
|
||||
@ -1554,13 +1552,11 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
log_warning_errno(r, "Failed to parse --exec-delay= value '%s', ignoring: %m", optarg);
|
||||
break;
|
||||
case 't':
|
||||
r = safe_atou64(optarg, &arg_event_timeout_usec);
|
||||
r = parse_sec(optarg, &arg_event_timeout_usec);
|
||||
if (r < 0)
|
||||
log_warning("Invalid --event-timeout ignored: %s", optarg);
|
||||
else {
|
||||
arg_event_timeout_usec *= USEC_PER_SEC;
|
||||
arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1;
|
||||
}
|
||||
log_warning_errno(r, "Failed to parse --event-timeout= value '%s', ignoring: %m", optarg);
|
||||
|
||||
arg_event_timeout_warn_usec = DIV_ROUND_UP(arg_event_timeout_usec, 3);
|
||||
break;
|
||||
case 'D':
|
||||
arg_debug = true;
|
||||
|
Loading…
Reference in New Issue
Block a user