]> 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>
Thu, 31 Jan 2019 09:10:58 +0000 (10:10 +0100)
Signed-off-by: ondra <ondrak@localhost.localdomain>
src/lxc/utils.c

index ccd7469ec9415a0e8b31db505d1dbf897a4207f5..c4c827c59a776772a7feb8f02a56c8b3338c5016 100644 (file)
@@ -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);
        }