From c326f712302c5586080ce6da63dc1f1524427d62 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 22 Jun 2025 18:13:36 -0700 Subject: [PATCH] stdbuf: support AIX * src/stdbuf.c (set_LD_PRELOAD): Use the AIX specific environment variables LDR_PRELOAD or LDR_PRELOAD64. * NEWS: Mention the bugfix. --- NEWS | 3 +++ src/stdbuf.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 8259423684..8b3d9d3cc2 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,9 @@ GNU coreutils NEWS -*- outline -*- 'sort +0.18446744073709551615R input' on 64 bit systems. [bug introduced in coreutils-7.2] + stdbuf now works on AIX. Previously it would have been ineffective. + [bug introduced with the stdbuf program in coreutils-7.5] + tty now exits with status 4 with a special diagnostic if ttyname fails even though standard input is a tty. Formerly it quietly pretended that standard input was not a tty. diff --git a/src/stdbuf.c b/src/stdbuf.c index ba42468388..9fa9d01f41 100644 --- a/src/stdbuf.c +++ b/src/stdbuf.c @@ -192,6 +192,9 @@ set_LD_PRELOAD (void) int ret; #ifdef __APPLE__ char const *preload_env = "DYLD_INSERT_LIBRARIES"; +#elif defined _AIX + char const *preload_env = (sizeof (void *) < 8 + ? "LDR_PRELOAD" : "LDR_PRELOAD64"); #else char const *preload_env = "LD_PRELOAD"; #endif -- 2.47.3