From patchwork Mon Aug 31 11:21:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 512451 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0EB931401E7 for ; Mon, 31 Aug 2015 21:21:31 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=F/nxkIyO; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=EaxTS1reV4BcXkn08uUOE8/mInGgQG4nu5hFzoqXtmpeJ5RdQNfPR ECeHJ8Klo15Y0iLEJ38ERb4DH+i8tZxjtd7em973230xKYctNLSpCN6Qa6YeCHNS JpNfZsGS0Z/OpDrbHzmcQJHEu2/f7pmShGTQWDr3+alErqOZ9xp+rw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=XVXDc0fbHlE140H9v1VWYWyJqjU=; b=F/nxkIyO2Uu/AkmXwhVQ gU5oDO179mh2LJ3SNImsomvRJDL8hfTJk9vnzZ0RTyltdXMyrJZCqTk2KuQT8vnK b0BiuQHtWGfb9VVLFkGNyreFEAKyKCam3ik8mDn6oZSPuaVsdr5zL+9n1ds3i5p7 XS3uVQ5NJHMJeJuBMgepAeQ= Received: (qmail 82075 invoked by alias); 31 Aug 2015 11:21:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 81390 invoked by uid 89); 31 Aug 2015 11:21:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: smtp-relay.CeBiTec.Uni-Bielefeld.DE Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 31 Aug 2015 11:21:21 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id BBAD37E4 for ; Mon, 31 Aug 2015 13:21:18 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id mtMLqrsa5eqq for ; Mon, 31 Aug 2015 13:21:17 +0200 (CEST) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.110]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 456277E3 for ; Mon, 31 Aug 2015 13:21:17 +0200 (CEST) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.1+Sun/8.15.1/Submit) id t7VBLGvV023115; Mon, 31 Aug 2015 13:21:16 +0200 (CEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: Avoid strndup in gcc.c (PR bootstrap/67363) Date: Mon, 31 Aug 2015 13:21:16 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes As described in the PR, this patch https://gcc.gnu.org/ml/gcc-patches/2015-08/msg01549.html broke bootstrap on a couple of platforms that lack strndup in libc. Fixed as follows, matching other uses of xstrndup in the gcc subdirectory. Bootstrapped on i386-pc-solaris2.10, installed on mainline as obvious. Rainer 2015-08-31 Rainer Orth PR bootstrap/67363 * gcc.c (env_manager::xput): Replace strndup by xstrndup. # HG changeset patch # Parent 1b9570b3c98bf549aba6dee203d37955e96d744d Avoid strndup in gcc.c (PR bootstrap/67363) diff --git a/gcc/gcc.c b/gcc/gcc.c --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -123,7 +123,7 @@ env_manager::xput (const char *string) gcc_assert (equals); struct kv kv; - kv.m_key = strndup (string, equals - string); + kv.m_key = xstrndup (string, equals - string); const char *cur_value = ::getenv (kv.m_key); if (m_debug) fprintf (stderr, "saving old value: %s\n",cur_value);