svn commit: r235520 - stable/9/usr.bin/stdbuf
Jeremie Le Hen
jlh at FreeBSD.org
Wed May 16 20:31:38 UTC 2012
Author: jlh
Date: Wed May 16 20:31:37 2012
New Revision: 235520
URL: http://svn.freebsd.org/changeset/base/235520
Log:
MFC r235142:
Always define LD_32_PRELOAD so it works for 32 bits binaries on
64 bits platforms. Let rtld(1) decide if it needs to honor it
or not.
While here, fix a small bug in error reporting when asprintf(3)
returns an error.
Modified:
stable/9/usr.bin/stdbuf/stdbuf.c
Directory Properties:
stable/9/usr.bin/stdbuf/ (props changed)
Modified: stable/9/usr.bin/stdbuf/stdbuf.c
==============================================================================
--- stable/9/usr.bin/stdbuf/stdbuf.c Wed May 16 20:30:20 2012 (r235519)
+++ stable/9/usr.bin/stdbuf/stdbuf.c Wed May 16 20:31:37 2012 (r235520)
@@ -32,6 +32,7 @@
#include <unistd.h>
#define LIBSTDBUF "/usr/lib/libstdbuf.so"
+#define LIBSTDBUF32 "/usr/lib32/libstdbuf.so"
extern char *__progname;
@@ -92,7 +93,17 @@ main(int argc, char *argv[])
LIBSTDBUF);
if (i < 0 || putenv(preload1) == -1)
- warn("Failed to set environment variable: %s", preload1);
+ warn("Failed to set environment variable: LD_PRELOAD");
+
+ preload0 = getenv("LD_32_PRELOAD");
+ if (preload0 == NULL)
+ i = asprintf(&preload1, "LD_32_PRELOAD=" LIBSTDBUF32);
+ else
+ i = asprintf(&preload1, "LD_32_PRELOAD=%s:%s", preload0,
+ LIBSTDBUF32);
+
+ if (i < 0 || putenv(preload1) == -1)
+ warn("Failed to set environment variable: LD_32_PRELOAD");
execvp(argv[0], argv);
err(2, "%s", argv[0]);
More information about the svn-src-stable-9
mailing list