-
-
Save lilyball/8928594 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The C method signature is as follows: | |
| int | |
| getgrouplist(const char *name, int basegid, int *groups, int *ngroups); | |
| // My Rust extern block | |
| extern { | |
| fn getgrouplist(name: *libc::c_char, | |
| basegid: libc::c_int, | |
| groups: *mut libc::c_int, | |
| ngroups: *mut libc::c_int) -> libc::c_int; | |
| } | |
| // Trying to use it | |
| let groups = 0; | |
| let num_groups = 0; | |
| // How do I setup a pointer to integer type ? | |
| unsafe { | |
| getgrouplist((*pw).pw_name, (*pw).pw_gid, &mut groups, &mut num_groups); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment