diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-10-06 17:02:29 +0200 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-11-03 10:00:37 +0100 |
| commit | 66a65c77dbf4f200bbc408a3c54916ef711539d6 (patch) | |
| tree | 80dfe10001d8ef06c34ab05e030075e1d1c8656b | |
| parent | feecc77ce9386c694ec7473d6b09485d068f14e1 (diff) | |
| download | mullvadvpn-66a65c77dbf4f200bbc408a3c54916ef711539d6.tar.xz mullvadvpn-66a65c77dbf4f200bbc408a3c54916ef711539d6.zip | |
Remove unsafe `geteuid` call by swapping libc for nix
| -rw-r--r-- | test/test-manager/src/container.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/test-manager/src/container.rs b/test/test-manager/src/container.rs index 9560f48b3e..a4ab6725d9 100644 --- a/test/test-manager/src/container.rs +++ b/test/test-manager/src/container.rs @@ -1,12 +1,14 @@ #![cfg(target_os = "linux")] +use nix::unistd::geteuid; use tokio::process::Command; /// Re-launch self with rootlesskit if we're not root. /// Allows for rootless and containerized networking. /// The VNC port is published to localhost. pub async fn relaunch_with_rootlesskit(vnc_port: Option<u16>) { - if unsafe { libc::geteuid() } == 0 { + // check if user is root (`man getuid`). + if geteuid().is_root() { return; } |
