From: ondra Date: Fri, 11 Jan 2019 16:42:13 +0000 (+0000) Subject: Fixing hooks functionality Android where 'sh' is placed under /system/bin X-Git-Tag: lxc-3.2.0~186^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecfa5693e927b9b7b79fe4011e47623b34f89fae;p=thirdparty%2Flxc.git Fixing hooks functionality Android where 'sh' is placed under /system/bin Signed-off-by: ondra --- diff --git a/src/lxc/utils.c b/src/lxc/utils.c index ef71b6df7..b0bd11254 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -447,7 +447,12 @@ struct lxc_popen_FILE *lxc_popen(const char *command) if (ret < 0) _exit(EXIT_FAILURE); - execl("/bin/sh", "sh", "-c", command, (char *)NULL); + /* check if /bin/sh exist, otherwise try Android location /system/bin/sh */ + if (file_exists("/bin/sh")) + execl("/bin/sh", "sh", "-c", command, (char *)NULL); + else + execl("/system/bin/sh", "sh", "-c", command, (char *)NULL); + _exit(127); }