]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fixing hooks functionality Android where 'sh' is placed under /system/bin
authorondra <ondrak@localhost.localdomain>
Fri, 11 Jan 2019 16:42:13 +0000 (16:42 +0000)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 10 Apr 2019 16:40:11 +0000 (18:40 +0200)
Signed-off-by: ondra <ondrak@localhost.localdomain>
src/lxc/utils.c

index 6e9165ae45ca752049d1637199a652355e739764..1e48498aef823f22a777f8073873d39dd2895343 100644 (file)
@@ -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);
        }