mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 10:51:20 +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))
|
if (proc_cmdline_value_missing(key, value))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = safe_atou64(value, &arg_event_timeout_usec);
|
r = parse_sec(value, &arg_event_timeout_usec);
|
||||||
if (r >= 0) {
|
if (r >= 0)
|
||||||
arg_event_timeout_usec *= USEC_PER_SEC;
|
arg_event_timeout_warn_usec = DIV_ROUND_UP(arg_event_timeout_usec, 3);
|
||||||
arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (proc_cmdline_key_streq(key, "udev.children_max")) {
|
} 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);
|
log_warning_errno(r, "Failed to parse --exec-delay= value '%s', ignoring: %m", optarg);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
r = safe_atou64(optarg, &arg_event_timeout_usec);
|
r = parse_sec(optarg, &arg_event_timeout_usec);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_warning("Invalid --event-timeout ignored: %s", optarg);
|
log_warning_errno(r, "Failed to parse --event-timeout= value '%s', ignoring: %m", optarg);
|
||||||
else {
|
|
||||||
arg_event_timeout_usec *= USEC_PER_SEC;
|
arg_event_timeout_warn_usec = DIV_ROUND_UP(arg_event_timeout_usec, 3);
|
||||||
arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
arg_debug = true;
|
arg_debug = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user