1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-12 13:18:14 +03:00

udev: use get_proc_cmdline_key instead of FOREACH_WORD_QUOTED

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-09-12 19:03:35 +01:00
parent e788ef482f
commit 303a2ebcb6

View File

@ -191,20 +191,12 @@ static int load_link(link_config_ctx *ctx, const char *filename) {
} }
static bool enable_name_policy(void) { static bool enable_name_policy(void) {
_cleanup_free_ char *line = NULL; _cleanup_free_ char *value = NULL;
const char *word, *state;
int r; int r;
size_t l;
r = proc_cmdline(&line); r = get_proc_cmdline_key("net.ifnames=", &value);
if (r < 0) { if (r > 0 && streq(value, "0"))
log_warning_errno(r, "Failed to read /proc/cmdline, ignoring: %m"); return false;
return true;
}
FOREACH_WORD_QUOTED(word, l, line, state)
if (strneq(word, "net.ifnames=0", l))
return false;
return true; return true;
} }