]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: use get_proc_cmdline_key instead of FOREACH_WORD_QUOTED
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 12 Sep 2016 18:03:35 +0000 (19:03 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Sep 2016 00:10:54 +0000 (20:10 -0400)
src/udev/net/link-config.c

index eedd94e777eadcf9ae19f7a83a34add562a56350..ece9248c2ab4073c4722a58628571df88453209e 100644 (file)
@@ -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;
 }