is_superuser 1.0.1

A cross-platform solution for finding out if the running user is a superuser.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use libc;
/// Returns true if the current user has root privileges, or false otherwise.
pub fn is_superuser() -> bool {
    unsafe {
        if libc::geteuid() != 0 {
            return false
        } else {
            return true
        }
    }
}