Files
vhaudiquet 8345f51d2f
CI / build (push) Successful in 16m23s
CI / snap (push) Successful in 4m1s
Multiple changes:
- 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
2026-02-06 12:04:25 +01:00

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)
}