From ecfa5693e927b9b7b79fe4011e47623b34f89fae Mon Sep 17 00:00:00 2001 From: ondra Date: Fri, 11 Jan 2019 16:42:13 +0000 Subject: [PATCH] Fixing hooks functionality Android where 'sh' is placed under /system/bin Signed-off-by: ondra --- src/lxc/utils.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); } -- 2.47.2