Skip to content

Commit 591bef3

Browse files
committed
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 #1361 Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
1 parent 0b228cf commit 591bef3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/uucore/src/lib/features/utmpx.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,21 @@ macro_rules! chars2string {
7070
mod ut {
7171
pub static DEFAULT_FILE: &str = "/var/run/utmp";
7272

73+
#[cfg(not(target_env = "musl"))]
7374
pub use libc::__UT_HOSTSIZE as UT_HOSTSIZE;
75+
#[cfg(target_env = "musl")]
76+
pub use libc::UT_HOSTSIZE;
77+
78+
#[cfg(not(target_env = "musl"))]
7479
pub use libc::__UT_LINESIZE as UT_LINESIZE;
80+
#[cfg(target_env = "musl")]
81+
pub use libc::UT_LINESIZE;
82+
83+
#[cfg(not(target_env = "musl"))]
7584
pub use libc::__UT_NAMESIZE as UT_NAMESIZE;
85+
#[cfg(target_env = "musl")]
86+
pub use libc::UT_NAMESIZE;
87+
7688
pub const UT_IDSIZE: usize = 4;
7789

7890
pub use libc::ACCOUNTING;

0 commit comments

Comments
 (0)