summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-12 19:03:35 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-13 20:10:54 -0400
commit303a2ebcb600e475fd8b87caef81cf3790f0fa81 (patch)
tree4e9aa75325500f396f7273235f6394594086ade9
parente788ef482f951ee07ba029e8a80e3bff026a70c9 (diff)
udev: use get_proc_cmdline_key instead of FOREACH_WORD_QUOTED
-rw-r--r--src/udev/net/link-config.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index eedd94e777..ece9248c2a 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -191,20 +191,12 @@ static int load_link(link_config_ctx *ctx, const char *filename) {
}
static bool enable_name_policy(void) {
- _cleanup_free_ char *line = NULL;
- const char *word, *state;
+ _cleanup_free_ char *value = NULL;
int r;
- size_t l;
- r = proc_cmdline(&line);
- if (r < 0) {
- log_warning_errno(r, "Failed to read /proc/cmdline, ignoring: %m");
- return true;
- }
-
- FOREACH_WORD_QUOTED(word, l, line, state)
- if (strneq(word, "net.ifnames=0", l))
- return false;
+ r = get_proc_cmdline_key("net.ifnames=", &value);
+ if (r > 0 && streq(value, "0"))
+ return false;
return true;
}