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-2.0.10~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d277c519f133338e295ef8a919da22bfbc1a3d6;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 ccd7469ec..c4c827c59 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -501,7 +501,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); }