Skip to content

Commit 309e473

Browse files
committed
Patched uid=0 check to ignore gid, since it is non-zero on some
android phones after calling su/setuid(). Tried setguid(0) to no avail.
1 parent 88cf061 commit 309e473

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

posix/posix.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,9 @@ int main(int argc, char *argv[])
603603
int8_t res;
604604

605605
/* check if user is root */
606-
if ((getuid()) || (getgid())) {
607-
fprintf(stderr, "Error - you must be root to run '%s' !\n", argv[0]);
606+
/* PGS: On some Android phones, it is not possible to set gid to zero. So only check uid. */
607+
if ((getuid()) /* || (getgid()) */) {
608+
fprintf(stderr, "Error - you must be root to run '%s' ! (uid=%d, gid=%d)\n", argv[0],getuid(),getgid());
608609
exit(EXIT_FAILURE);
609610
}
610611

0 commit comments

Comments
 (0)