1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

who: fix --lookup

This closes #2181.

`who --lookup` is failing with a runtime panic (double free).
Since `crate::dns-lookup` already includes a safe wrapper for `getaddrinfo`
I used this crate instead of further debugging the existing code in
utmpx::canon_host().

* It was neccessary to remove the version constraint for libc in uucore.
This commit is contained in:
Jan Scheer 2021-05-13 10:17:57 +02:00
parent a5f8ca60b5
commit a4fc2b5106
7 changed files with 79 additions and 65 deletions

View file

@ -98,6 +98,23 @@ fn test_short_format_q() {
assert_eq!(v_actual, v_expect);
}
#[cfg(target_os = "linux")]
#[test]
fn test_no_flag() {
let scene = TestScenario::new(util_name!());
let actual = scene.ucmd().succeeds().stdout_move_str();
let expect = scene
.cmd_keepenv(util_name!())
.env("LANGUAGE", "C")
.succeeds()
.stdout_move_str();
let v_actual: Vec<&str> = actual.split_whitespace().collect();
let v_expect: Vec<&str> = expect.split_whitespace().collect();
assert_eq!(v_actual, v_expect);
}
#[cfg(target_os = "linux")]
fn expected_result(args: &[&str]) -> String {
TestScenario::new(util_name!())