]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
execute: try /lxc.init.static as last resort
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 3 Jun 2014 03:03:46 +0000 (22:03 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 3 Jun 2014 14:10:56 +0000 (10:10 -0400)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/execute.c

index 651c47d990e2253aa3bf340050d8f460d3f4016f..4ebc214ab99824be312305a767bfc3d2e0c3d308 100644 (file)
@@ -104,6 +104,20 @@ static char *choose_init(void)
        ret = stat(retv, &mystat);
        if (ret == 0)
                return retv;
+
+       /*
+        * Last resort, look for the statically compiled init.lxc which we
+        * hopefully bind-mounted in
+        */
+       ret = snprintf(retv, PATH_MAX, "/init.lxc.static");
+       if (ret < 0 || ret >= PATH_MAX) {
+               WARN("Nonsense - name /lxc.init.static too long");
+               goto out1;
+       }
+       ret = stat(retv, &mystat);
+       if (ret == 0)
+               return retv;
+
 out1:
        free(retv);
        return NULL;