From 3d277c519f133338e295ef8a919da22bfbc1a3d6 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 ccd7469ec9..c4c827c59a 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); }