- deb: can use ppa as dependency - deb: cross and regular are using parallel nocheck builds - deb: ephemeral will not pull keyring if no root powers
16 lines
434 B
Rust
16 lines
434 B
Rust
//! Root privilege checking utilities
|
|
|
|
use std::error::Error;
|
|
|
|
/// Check if the current process has root privileges
|
|
///
|
|
/// # Returns
|
|
/// * `Ok(true)` - Running as root
|
|
/// * `Ok(false)` - Not running as root
|
|
/// * `Err` - Failed to check privileges
|
|
pub fn is_root() -> Result<bool, Box<dyn Error>> {
|
|
// Check if we're running as root by checking the effective user ID
|
|
let uid = unsafe { libc::geteuid() };
|
|
Ok(uid == 0)
|
|
}
|