ARGSUSED */
| 797 | #endif |
| 798 | /* ARGSUSED */ |
| 799 | int |
| 800 | sys_setgroups(struct thread *td, struct setgroups_args *uap) |
| 801 | { |
| 802 | gid_t smallgroups[XU_NGROUPS]; |
| 803 | gid_t *groups; |
| 804 | u_int gidsetsize; |
| 805 | int error; |
| 806 | |
| 807 | gidsetsize = uap->gidsetsize; |
| 808 | if (gidsetsize > ngroups_max + 1) |
| 809 | return (EINVAL); |
| 810 | |
| 811 | if (gidsetsize > XU_NGROUPS) |
| 812 | groups = malloc(gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK); |
| 813 | else |
| 814 | groups = smallgroups; |
| 815 | |
| 816 | error = copyin(uap->gidset, groups, gidsetsize * sizeof(gid_t)); |
| 817 | if (error == 0) |
| 818 | error = kern_setgroups(td, gidsetsize, groups); |
| 819 | |
| 820 | if (gidsetsize > XU_NGROUPS) |
| 821 | free(groups, M_TEMP); |
| 822 | return (error); |
| 823 | } |
| 824 | |
| 825 | int |
| 826 | kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups) |
nothing calls this directly
no test coverage detected