Commit f2b79ce9 authored by Dillon Amburgey's avatar Dillon Amburgey Committed by Riku Voipio
Browse files

linux-user: Support setgroups syscall with no groups

parent bfb669f3
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -7680,18 +7680,20 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
        {
            int gidsetsize = arg1;
            target_id *target_grouplist;
            gid_t *grouplist;
            gid_t *grouplist = NULL;
            int i;

            if (gidsetsize) {
                grouplist = alloca(gidsetsize * sizeof(gid_t));
                target_grouplist = lock_user(VERIFY_READ, arg2, gidsetsize * 2, 1);
                if (!target_grouplist) {
                    ret = -TARGET_EFAULT;
                    goto fail;
                }
            for(i = 0;i < gidsetsize; i++)
                for (i = 0; i < gidsetsize; i++) {
                    grouplist[i] = low2highgid(tswapid(target_grouplist[i]));
                }
                unlock_user(target_grouplist, arg2, 0);
            }
            ret = get_errno(setgroups(gidsetsize, grouplist));
        }
        break;