]> git.proxmox.com Git - mirror_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)
committerondra <ondrak@localhost.localdomain>
Fri, 18 Jan 2019 08:34:02 +0000 (10:34 +0200)
Signed-off-by: ondra <ondrak@localhost.localdomain>
src/lxc/utils.c

index ef71b6df7d2469aeb26c8ebd51ffef3838701f3e..b0bd112548915b6dac77bf1ca41ddded788488d8 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);
        }