chiark / gitweb /
fstab-generator: only handle block devices with root= kernel command line parameter
authorHarald Hoyer <harald@redhat.com>
Mon, 4 Mar 2013 20:00:56 +0000 (21:00 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 4 Mar 2013 20:00:56 +0000 (21:00 +0100)
skip s.th. like root=nfs:... root=iscsi:... root=nbd:...

src/fstab-generator/fstab-generator.c

index a8436e6233f1c54cf190c54456427089deb00903..986f72d7e6b25c4b6df5edfb3a1a2b29ab626af1 100644 (file)
@@ -530,18 +530,21 @@ static int parse_new_root_from_proc_cmdline(void) {
                 free(word);
         }
 
-        if (what) {
+        if (!what) {
+                log_error("Could not find a root= entry on the kernel commandline.");
+                return 0;
+        }
 
-                log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
-                r = add_mount(what, "/sysroot", type, opts, 0, false, false, false,
-                              false, false, true, "/proc/cmdline");
+        if (what[0] != '/') {
+                log_debug("Skipping entry what=%s where=/sysroot type=%s", what, type);
+                return 0;
+        }
 
-                if (r < 0)
-                        return r;
-        } else
-                log_error("Could not find a root= entry on the kernel commandline.");
+        log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
+        r = add_mount(what, "/sysroot", type, opts, 0, false, false, false,
+                      false, false, true, "/proc/cmdline");
 
-        return 0;
+        return (r < 0) ? r : 0;
 }
 
 static int parse_proc_cmdline(void) {