Skip to content

Commit

Permalink
veritysetup-generator: treat '-' and '_' as equivalent
Browse files Browse the repository at this point in the history
  • Loading branch information
keszybz authored and poettering committed Nov 20, 2018
1 parent 606b0b6 commit ad0cdb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/test/test-proc-cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ static int parse_item_given(const char *key, const char *value, void *data) {
bool *strip = data;

log_info("%s: option <%s> = <%s>", __func__, key, strna(value));
if (streq(key, "foo_bar"))
if (proc_cmdline_key_streq(key, "foo_bar"))
assert_se(streq(value, "quux"));
else if (streq(key, "wuff-piep"))
else if (proc_cmdline_key_streq(key, "wuff-piep"))
assert_se(streq(value, "tuet "));
else if (streq(key, "space"))
else if (proc_cmdline_key_streq(key, "space"))
assert_se(streq(value, "x y z"));
else if (streq(key, "miepf"))
else if (proc_cmdline_key_streq(key, "miepf"))
assert_se(streq(value, "uuu"));
else if (in_initrd() && *strip && streq(key, "zumm"))
else if (in_initrd() && *strip && proc_cmdline_key_streq(key, "zumm"))
assert_se(!value);
else if (in_initrd() && !*strip && streq(key, "rd.zumm"))
else if (in_initrd() && !*strip && proc_cmdline_key_streq(key, "rd.zumm"))
assert_se(!value);
else
assert_not_reached("Bad key!");
Expand Down
8 changes: 4 additions & 4 deletions src/veritysetup/veritysetup-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ static int create_device(void) {
static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {
int r;

if (streq(key, "systemd.verity")) {
if (proc_cmdline_key_streq(key, "systemd.verity")) {

r = value ? parse_boolean(value) : 1;
if (r < 0)
log_warning("Failed to parse verity= kernel command line switch %s. Ignoring.", value);
else
arg_enabled = r;

} else if (streq(key, "roothash")) {
} else if (proc_cmdline_key_streq(key, "roothash")) {

if (proc_cmdline_value_missing(key, value))
return 0;
Expand All @@ -135,7 +135,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (r < 0)
return log_oom();

} else if (streq(key, "systemd.verity_root_data")) {
} else if (proc_cmdline_key_streq(key, "systemd.verity_root_data")) {

if (proc_cmdline_value_missing(key, value))
return 0;
Expand All @@ -144,7 +144,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (r < 0)
return log_oom();

} else if (streq(key, "systemd.verity_root_hash")) {
} else if (proc_cmdline_key_streq(key, "systemd.verity_root_hash")) {

if (proc_cmdline_value_missing(key, value))
return 0;
Expand Down

0 comments on commit ad0cdb6

Please sign in to comment.