[systemd-devel] [PATCH 2/4] fstab-generator: skip generation, if sysroot.mount already exists

harald at redhat.com harald at redhat.com
Mon Mar 4 22:28:42 PST 2013


From: Harald Hoyer <harald at redhat.com>

---
 src/fstab-generator/fstab-generator.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index fade192..3b8329b 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -450,10 +450,19 @@ finish:
 
 static int parse_new_root_from_proc_cmdline(void) {
         char *w, *state;
-        _cleanup_free_ char *what = NULL, *type = NULL, *opts = NULL, *line = NULL;
+        _cleanup_free_ char *what = NULL, *type = NULL, *opts = NULL, *line = NULL, *mu = NULL;
         int r;
         size_t l;
 
+        /* Skip generation, if sysroot.mount already exists */
+        mu = strjoin(arg_dest, "/", "sysroot.mount", NULL);
+        if (!mu)
+                return log_oom();
+
+        r = access(mu, R_OK);
+        if (r == 0)
+            return 0;
+
         r = read_one_line_file("/proc/cmdline", &line);
         if (r < 0) {
                 log_error("Failed to read /proc/cmdline, ignoring: %s", strerror(-r));
-- 
1.8.1



More information about the systemd-devel mailing list