]> git.proxmox.com Git - proxmox.git/commit
sys: Use safe wrapper for libc::isatty
authorMaximiliano Sandoval R <m.sandoval@proxmox.com>
Fri, 16 Feb 2024 14:59:00 +0000 (15:59 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 16 Feb 2024 15:55:58 +0000 (16:55 +0100)
commit430df21720f93ee46c8510d20b07c224c17394ff
treeaedef84a45f8f5e2d10a51faaec649b1f88f8f6c
parent7126249102cfbe3f26d74ff6d6179c08b9513025
sys: Use safe wrapper for libc::isatty

Use the `std::io::IsTerminal` trait introduced in Rust 1.70.

Internally it calls `libc::isatty`, see [1, 2]. Note that it switches
the comparison from `== 1` to `!= 0` which shouldn't make a difference
assuming that libc::isatty upholds the promises made in its man page.

The MSRV was set on the workspace to reflect this change.

[1] https://doc.rust-lang.org/src/std/io/stdio.rs.html#1079
[2] https://doc.rust-lang.org/src/std/sys/unix/io.rs.html#79

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Cargo.toml
proxmox-sys/src/linux/tty.rs