Remove "users" crate, call libc directly

This is all I actually needed anyways
This commit is contained in:
John Doty 2024-08-12 17:37:34 -07:00
parent 35dcf93971
commit df0ca4ce31
3 changed files with 4 additions and 13 deletions

12
Cargo.lock generated
View file

@ -330,6 +330,7 @@ dependencies = [
"env_logger", "env_logger",
"home", "home",
"indoc", "indoc",
"libc",
"log", "log",
"open", "open",
"pretty_assertions", "pretty_assertions",
@ -341,7 +342,6 @@ dependencies = [
"tokio-stream", "tokio-stream",
"toml", "toml",
"tui", "tui",
"users",
"xdg", "xdg",
] ]
@ -1114,16 +1114,6 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "users"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
dependencies = [
"libc",
"log",
]
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.11.0+wasi-snapshot-preview1" version = "0.11.0+wasi-snapshot-preview1"

View file

@ -40,4 +40,4 @@ tempdir = "0.3"
procfs = "0.14.1" procfs = "0.14.1"
[target.'cfg(target_family="unix")'.dependencies] [target.'cfg(target_family="unix")'.dependencies]
users = "0.11" libc = "0.2.155"

View file

@ -55,7 +55,8 @@ fn socket_directory() -> Result<std::path::PathBuf> {
Ok(path) => Ok(path), Ok(path) => Ok(path),
Err(_) => { Err(_) => {
let mut path = std::env::temp_dir(); let mut path = std::env::temp_dir();
path.push(format!("fwd{}", users::get_current_uid())); let uid = unsafe { libc::getuid() };
path.push(format!("fwd{}", uid));
Ok(path) Ok(path)
} }
} }