From owner-svn-src-stable@FreeBSD.ORG Wed May 16 20:31:38 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63D971065673; Wed, 16 May 2012 20:31:38 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EB7E8FC1C; Wed, 16 May 2012 20:31:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4GKVciM060706; Wed, 16 May 2012 20:31:38 GMT (envelope-from jlh@svn.freebsd.org) Received: (from jlh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4GKVciF060704; Wed, 16 May 2012 20:31:38 GMT (envelope-from jlh@svn.freebsd.org) Message-Id: <201205162031.q4GKVciF060704@svn.freebsd.org> From: Jeremie Le Hen Date: Wed, 16 May 2012 20:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235520 - stable/9/usr.bin/stdbuf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2012 20:31:38 -0000 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 #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]);