diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-06-27 23:14:57 +0200 |
---|---|---|
committer | Ryze <50497128+ryze312@users.noreply.github.com> | 2024-06-27 21:21:11 +0000 |
commit | ae97e7cd19ae963a0e5178b9ad815275e57ae3ed (patch) | |
tree | 4389ab5e49ab0f20242755ae5a0d00c13aaea2ea | |
parent | 1db2518ee8f08f1c90c5b275f9d2a38ef4d2ab2e (diff) | |
download | where-rs-ae97e7cd19ae963a0e5178b9ad815275e57ae3ed.tar.gz where-rs-ae97e7cd19ae963a0e5178b9ad815275e57ae3ed.tar.bz2 where-rs-ae97e7cd19ae963a0e5178b9ad815275e57ae3ed.zip |
Fix upstream bug with Utmpx crate
-rwxr-xr-x | where-rs/Cargo.toml | 2 | ||||
-rwxr-xr-x | whered/Cargo.toml | 2 | ||||
-rwxr-xr-x | whrd/Cargo.toml | 2 | ||||
-rwxr-xr-x | whrd/src/lib.rs | 8 |
4 files changed, 10 insertions, 4 deletions
diff --git a/where-rs/Cargo.toml b/where-rs/Cargo.toml index 62bf873..9f4aeaf 100755 --- a/where-rs/Cargo.toml +++ b/where-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "where-rs" -version = "1.0.0" +version = "1.1.0" edition = "2021" description = "A small Rust client for the WHRD/UDP protocol, to access a list of logged in users on multiple systems at once." authors = ["Starscouts", "ryze132"] diff --git a/whered/Cargo.toml b/whered/Cargo.toml index 22a9f62..f29949c 100755 --- a/whered/Cargo.toml +++ b/whered/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "whered" -version = "1.0.0" +version = "1.1.0" edition = "2021" description = "A small Rust server for the WHRD/UDP protocol, to access a list of logged in users on multiple systems at once." authors = ["Starscouts", "ryze132"] diff --git a/whrd/Cargo.toml b/whrd/Cargo.toml index e1855a3..d1602a8 100755 --- a/whrd/Cargo.toml +++ b/whrd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "whrd" -version = "1.0.0" +version = "1.1.0" edition = "2021" description = "A Rust library to work with the WHRD/UDP protocol, a protocol to access a list of logged in users on multiple systems at once." authors = ["Starscouts", "ryze132"] diff --git a/whrd/src/lib.rs b/whrd/src/lib.rs index 8ff483d..fb45f74 100755 --- a/whrd/src/lib.rs +++ b/whrd/src/lib.rs @@ -1,4 +1,5 @@ use std::io::Cursor; +use std::path::PathBuf; use coreutils_core::os::utmpx::*; use crate::error::{WhereResult, EncodeDecodeResult, EncodeDecodeError}; @@ -192,7 +193,12 @@ impl From<Utmpx> for Session { } else { Some(host) }; - let active = utmpx.entry_type() == UtmpxKind::UserProcess; + + // Work around a bug in Utmpx causing killed sessions to show as + // active when they are not. + let mut path = PathBuf::from("/dev"); + path.push(utmpx.device_name().to_string()); + let active = utmpx.entry_type() == UtmpxKind::UserProcess && path.exists(); let login_time = utmpx.timeval().tv_sec; Self { |