summaryrefslogtreecommitdiff
path: root/src/basic/proc-cmdline.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-26 12:00:37 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-26 12:00:37 +0200
commitcb447ff5cc99e8c122a88fa78d7b80e4c572529b (patch)
treecb7f6c5ac2a5592e3de445858eda199c9ea26dd5 /src/basic/proc-cmdline.c
parent9de12b2ef4ccd95e7e1a4f37d507c50100dda637 (diff)
downloadsystemd-cb447ff5cc99e8c122a88fa78d7b80e4c572529b.tar.gz
proc-cmdline: use FLAGS_SET() where appropriate
This was mostly prompted by seeing the expression "in_initrd() && flags & PROC_CMDLINE_RD_STRICT", which uses & and && without any brackets. Let's make that a bit more readable and hide all doubts about operator precedence.
Diffstat (limited to 'src/basic/proc-cmdline.c')
-rw-r--r--src/basic/proc-cmdline.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
index 647c61ce73..b8839ef52c 100644
--- a/src/basic/proc-cmdline.c
+++ b/src/basic/proc-cmdline.c
@@ -64,10 +64,11 @@ int proc_cmdline_parse_given(const char *line, proc_cmdline_parse_t parse_item,
if (!in_initrd())
continue;
- if (flags & PROC_CMDLINE_STRIP_RD_PREFIX)
+ if (FLAGS_SET(flags, PROC_CMDLINE_STRIP_RD_PREFIX))
key = q;
- } else if (in_initrd() && flags & PROC_CMDLINE_RD_STRICT)
- continue;
+
+ } else if (FLAGS_SET(flags, PROC_CMDLINE_RD_STRICT) && in_initrd())
+ continue; /* And optionally filter out arguments that are intended only for the host */
value = strchr(key, '=');
if (value)
@@ -148,7 +149,7 @@ int proc_cmdline_get_key(const char *key, unsigned flags, char **value) {
if (isempty(key))
return -EINVAL;
- if ((flags & PROC_CMDLINE_VALUE_OPTIONAL) && !value)
+ if (FLAGS_SET(flags, PROC_CMDLINE_VALUE_OPTIONAL) && !value)
return -EINVAL;
r = proc_cmdline(&line);
@@ -183,7 +184,7 @@ int proc_cmdline_get_key(const char *key, unsigned flags, char **value) {
found = true;
- } else if (*e == 0 && (flags & PROC_CMDLINE_VALUE_OPTIONAL))
+ } else if (*e == 0 && FLAGS_SET(flags, PROC_CMDLINE_VALUE_OPTIONAL))
found = true;
} else {