chiark / gitweb /
nspawn: don't link journals in ephemeral mode
authorLennart Poettering <lennart@poettering.net>
Fri, 12 Dec 2014 15:58:57 +0000 (16:58 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 12 Dec 2014 16:30:25 +0000 (17:30 +0100)
src/nspawn/nspawn.c

index 8082166ee205f102e77404ce5ae4e93b9452cf1e..f6f20abdaf23b1db88865e4db0897f06d43a34d2 100644 (file)
@@ -687,6 +687,11 @@ static int parse_argv(int argc, char *argv[]) {
                 return -EINVAL;
         }
 
                 return -EINVAL;
         }
 
+        if (arg_ephemeral && !IN_SET(arg_link_journal, LINK_NO, LINK_AUTO)) {
+                log_error("--ephemeral and --link-journal= may not be combined.");
+                return -EINVAL;
+        }
+
         if (arg_volatile != VOLATILE_NO && arg_read_only) {
                 log_error("Cannot combine --read-only with --volatile. Note that --volatile already implies a read-only base hierarchy.");
                 return -EINVAL;
         if (arg_volatile != VOLATILE_NO && arg_read_only) {
                 log_error("Cannot combine --read-only with --volatile. Note that --volatile already implies a read-only base hierarchy.");
                 return -EINVAL;
@@ -1317,6 +1322,10 @@ static int setup_journal(const char *directory) {
         char *id;
         int r;
 
         char *id;
         int r;
 
+        /* Don't link journals in ephemeral mode */
+        if (arg_ephemeral)
+                return 0;
+
         p = strappend(directory, "/etc/machine-id");
         if (!p)
                 return log_oom();
         p = strappend(directory, "/etc/machine-id");
         if (!p)
                 return log_oom();
@@ -1345,8 +1354,7 @@ static int setup_journal(const char *directory) {
                          "Host and machine ids are equal (%s): refusing to link journals", id);
                 if (arg_link_journal == LINK_AUTO)
                         return 0;
                          "Host and machine ids are equal (%s): refusing to link journals", id);
                 if (arg_link_journal == LINK_AUTO)
                         return 0;
-                return
-                        -EEXIST;
+                return -EEXIST;
         }
 
         if (arg_link_journal == LINK_NO)
         }
 
         if (arg_link_journal == LINK_NO)