chiark / gitweb /
gpt-auto-generator: exit immediately if in container
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Oct 2013 02:13:01 +0000 (22:13 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Oct 2013 02:13:01 +0000 (22:13 -0400)
Otherwise we get an ugly warning when running systemd in
a container.

src/gpt-auto-generator/gpt-auto-generator.c

index ca54925da4e9ecdd001b37060143c7979ea9cd18..d2b4213af2ebafaba55170a515623fdae795fc8d 100644 (file)
@@ -38,6 +38,7 @@
 #include "libudev.h"
 #include "special.h"
 #include "unit-name.h"
+#include "virt.h"
 
 /* TODO:
  *
@@ -481,6 +482,13 @@ int main(int argc, char *argv[]) {
         umask(0022);
 
         if (in_initrd()) {
+                log_debug("In initrd, exiting.");
+                r = 0;
+                goto finish;
+        }
+
+        if (detect_container(NULL) > 0) {
+                log_debug("In a container, exiting.");
                 r = 0;
                 goto finish;
         }