diff options
Diffstat (limited to 'src/basic/proc-cmdline.c')
-rw-r--r-- | src/basic/proc-cmdline.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c index ae3323379..67da8d3cd 100644 --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c @@ -39,18 +39,12 @@ int proc_cmdline(char **ret) { return read_one_line_file("/proc/cmdline", ret); } -int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, unsigned flags) { - - _cleanup_free_ char *line = NULL; +int proc_cmdline_parse_given(const char *line, proc_cmdline_parse_t parse_item, void *data, unsigned flags) { const char *p; int r; assert(parse_item); - r = proc_cmdline(&line); - if (r < 0) - return r; - p = line; for (;;) { _cleanup_free_ char *word = NULL; @@ -67,11 +61,15 @@ int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, unsigned fla /* Filter out arguments that are intended only for the initrd */ q = startswith(word, "rd."); if (q) { +#if 0 /// elogind is never in initrd. Doesn't make any sense. if (!in_initrd()) continue; if (flags & PROC_CMDLINE_STRIP_RD_PREFIX) key = q; +#else + continue; +#endif // 0 } value = strchr(key, '='); @@ -86,6 +84,19 @@ int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, unsigned fla return 0; } +int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, unsigned flags) { + _cleanup_free_ char *line = NULL; + int r; + + assert(parse_item); + + r = proc_cmdline(&line); + if (r < 0) + return r; + + return proc_cmdline_parse_given(line, parse_item, data, flags); +} + static bool relaxed_equal_char(char a, char b) { return a == b || |