public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Avoid strndup in gcc.c (PR bootstrap/67363)
@ 2015-08-31 11:23 Rainer Orth
  0 siblings, 0 replies; only message in thread
From: Rainer Orth @ 2015-08-31 11:23 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

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  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR bootstrap/67363
	* gcc.c (env_manager::xput): Replace strndup by xstrndup.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-strndup.patch --]
[-- Type: text/x-patch, Size: 529 bytes --]

# 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);

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-31 11:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-31 11:23 Avoid strndup in gcc.c (PR bootstrap/67363) Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).