diff options
author | Filipe Brandenburger <filbranden@google.com> | 2019-01-23 19:48:54 -0800 |
---|---|---|
committer | Filipe Brandenburger <filbranden@google.com> | 2019-02-14 11:04:42 -0800 |
commit | 7b61ce3c44ef5908e817009ce4f9d2a7a37722be (patch) | |
tree | c0e8cdc688bd5904c5743b25364ef2514ad763ae /src/shared/conf-parser.c | |
parent | 93e4163e912b6895e61c43452a629f30a28eb70c (diff) | |
download | systemd-7b61ce3c44ef5908e817009ce4f9d2a7a37722be.tar.gz systemd-7b61ce3c44ef5908e817009ce4f9d2a7a37722be.tar.bz2 systemd-7b61ce3c44ef5908e817009ce4f9d2a7a37722be.zip |
time-util: Introduce parse_sec_def_infinity
This works like parse_sec() but defaults to USEC_INFINITY when passed an
empty string or only whitespace.
Also introduce config_parse_sec_def_infinity, which can be used to parse
config options using this function.
This is useful for time options that use "infinity" for default and that
can be reset by unsetting them.
Introduce a test case to ensure it works as expected.
Diffstat (limited to 'src/shared/conf-parser.c')
-rw-r--r-- | src/shared/conf-parser.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index b80c147807..aa8283313f 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -506,6 +506,7 @@ DEFINE_PARSER(unsigned, unsigned, safe_atou); DEFINE_PARSER(double, double, safe_atod); DEFINE_PARSER(nsec, nsec_t, parse_nsec); DEFINE_PARSER(sec, usec_t, parse_sec); +DEFINE_PARSER(sec_def_infinity, usec_t, parse_sec_def_infinity); DEFINE_PARSER(mode, mode_t, parse_mode); int config_parse_iec_size(const char* unit, |