mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
su: fix -g/-G
This commit is contained in:
@@ -176,14 +176,17 @@ int su_client_main(int argc, char *argv[]) {
|
||||
break;
|
||||
case 'g':
|
||||
case 'G': {
|
||||
vector<gid_t> gids;
|
||||
if (int gid = parse_int(optarg); gid >= 0) {
|
||||
gids.insert(c == 'g' ? gids.begin() : gids.end(), gid);
|
||||
if (c == 'g' && !req.gids.empty()) {
|
||||
req.gids.push_back(req.gids[0]);
|
||||
req.gids[0] = gid;
|
||||
} else {
|
||||
req.gids.push_back(gid);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Invalid GID: %s\n", optarg);
|
||||
usage(EXIT_FAILURE);
|
||||
}
|
||||
ranges::copy(gids, std::back_inserter(req.gids));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user