Skip to content

Commit

Permalink
Fixing hooks functionality Android where 'sh' is placed under /system…
Browse files Browse the repository at this point in the history
…/bin

Signed-off-by: ondra <ondrak@localhost.localdomain>
  • Loading branch information
ondra authored and Christian Brauner committed Jan 31, 2019
1 parent b2de32b commit 3d277c5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lxc/utils.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 3d277c5

Please sign in to comment.