diff mbox

Avoid strndup in gcc.c (PR bootstrap/67363)

Message ID ydd4mjf66vn.fsf@lokon.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Aug. 31, 2015, 11:21 a.m. UTC
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.
diff mbox

Patch

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