[lxc-devel] [PATCH 3/6] execute: try /lxc.init.static as last resort
Serge Hallyn
serge.hallyn at ubuntu.com
Tue Jun 3 03:03:46 UTC 2014
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
---
src/lxc/execute.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/lxc/execute.c b/src/lxc/execute.c
index 651c47d..4ebc214 100644
--- a/src/lxc/execute.c
+++ b/src/lxc/execute.c
@@ -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;
--
2.0.0
More information about the lxc-devel
mailing list