abuild-sudo: also look for adduser/group in /usr/sbin

seems like it moved in recent busybox. we need to support both variants
This commit is contained in:
Natanael Copa 2013-05-29 15:07:27 +02:00
parent 38ab58a5d6
commit 4423ab7b51

View File

@ -14,7 +14,9 @@
static const char* valid_cmds[] = { static const char* valid_cmds[] = {
"/bin/adduser", "/bin/adduser",
"/usr/sbin/adduser",
"/bin/addgroup", "/bin/addgroup",
"/usr/sbin/addgroup",
"/sbin/apk", "/sbin/apk",
NULL NULL
}; };
@ -24,6 +26,8 @@ const char *get_command_path(const char *cmd)
const char *p; const char *p;
int i; int i;
for (i = 0; valid_cmds[i] != NULL; i++) { for (i = 0; valid_cmds[i] != NULL; i++) {
if (access(valid_cmds[i], F_OK) == -1)
continue;
p = strrchr(valid_cmds[i], '/') + 1; p = strrchr(valid_cmds[i], '/') + 1;
if (strcmp(p, cmd) == 0) if (strcmp(p, cmd) == 0)
return valid_cmds[i]; return valid_cmds[i];