1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

utmpx.rs: use correct constant names for musl libc

Unfortunately, the name of those constants are not standardized:
glibc uses __UT_HOSTSIZE, __UT_LINESIZE, __UT_NAMESIZE
musl uses UT_HOSTSIZE, UT_LINESIZE, UT_NAMESIZE

See:
1. https://git.musl-libc.org/cgit/musl/tree/include/utmpx.h
2. https://github.com/bminor/glibc/blob/master/sysdeps/gnu/bits/utmpx.h#L35

This is a partial fix for https://github.com/uutils/coreutils/issues/1361

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
This commit is contained in:
Etienne Cordonnier 2025-03-15 22:27:53 +01:00
parent 0b228cfd3e
commit 591bef3759

View file

@ -70,9 +70,21 @@ macro_rules! chars2string {
mod ut {
pub static DEFAULT_FILE: &str = "/var/run/utmp";
#[cfg(not(target_env = "musl"))]
pub use libc::__UT_HOSTSIZE as UT_HOSTSIZE;
#[cfg(target_env = "musl")]
pub use libc::UT_HOSTSIZE;
#[cfg(not(target_env = "musl"))]
pub use libc::__UT_LINESIZE as UT_LINESIZE;
#[cfg(target_env = "musl")]
pub use libc::UT_LINESIZE;
#[cfg(not(target_env = "musl"))]
pub use libc::__UT_NAMESIZE as UT_NAMESIZE;
#[cfg(target_env = "musl")]
pub use libc::UT_NAMESIZE;
pub const UT_IDSIZE: usize = 4;
pub use libc::ACCOUNTING;