add doc string for elevate_privlages

This commit is contained in:
tylermurphy534 2022-11-10 19:23:21 -05:00
parent 9bb5154ae8
commit f528a215f5

View file

@ -40,6 +40,12 @@ pub fn read_file(dir: &str, file: &str) -> Option<String> {
}
/// Ekevate tge oruvukages if the current process
/// #### Arguments
/// * `uid` - The uid to set the process to
/// * `gid` - The gid to set the process to
/// #### Returns
/// If the process failes to elevate, it returns false
pub fn elevate_privilages(uid: u32, gid: u32) -> bool {
if unistd::setuid(Uid::from(uid)).is_err() {
return false;
@ -92,4 +98,4 @@ fn check_file_permissions(uid: u32, gid: u32, mode: u32, path: &str) -> bool {
/// Get the path of a file given a directory and file name
fn path(dir: &str, file: &str) -> String {
return format!("{}/{}.persist", dir, file);
}
}