Parse "timeout=0" as infinity in various generators (#6264)

This extends 2d79a0bbb9 to the kernel
command line parsing.

The parsing is changed a bit to only understand "0" as infinity. If units are
specified, parse normally, e.g. "0s" is just 0. This makes it possible to
provide a zero timeout if necessary.

Simple test is added.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1462378.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-07-03 14:29:32 +02:00
committed by Lennart Poettering
parent 131d5e148e
commit 0004f698df
7 changed files with 32 additions and 9 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ static int parse_one_option(const char *option) {
arg_type = CRYPT_PLAIN;
else if ((val = startswith(option, "timeout="))) {
r = parse_sec(val, &arg_timeout);
r = parse_sec_fix_0(val, &arg_timeout);
if (r < 0) {
log_error_errno(r, "Failed to parse %s, ignoring: %m", option);
return 0;