This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.13-197-gea389b1


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  ea389b12b3b65c4a7fa91fa76f8c99867eb37865 (commit)
      from  68a3f91fcad464c4737c1eaed4ae0bf539801fb2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ea389b12b3b65c4a7fa91fa76f8c99867eb37865

commit ea389b12b3b65c4a7fa91fa76f8c99867eb37865
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Mon May 16 10:13:54 2011 -0400

    Handle long variable names in putenv

diff --git a/ChangeLog b/ChangeLog
index b830ff8..70937c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-05-16  Ulrich Drepper  <drepper@gmail.com>
 
+	[BZ #11892]
+	* stdlib/putenv.c (putenv): Don't always create copy of the variable
+	on the stack.
+
 	[BZ #11895]
 	* misc/pselect.c (__pselect): Handle timeout value errors hidden
 	through underflows.
diff --git a/NEWS b/NEWS
index d8ced3c..a932446 100644
--- a/NEWS
+++ b/NEWS
@@ -10,13 +10,13 @@ Version 2.14
 * The following bugs are resolved with this release:
 
   386, 6420, 7101, 9730, 9732, 9809, 10138, 10149, 10157, 11257, 11258,
-  11487, 11532, 11578, 11653, 11668, 11697, 11724, 11820, 11895, 11901,
-  11945, 11947, 11952, 11987, 12052, 12083, 12158, 12178, 12200, 12346,
-  12393, 12420, 12432, 12445, 12449, 12453, 12454, 12460, 12469, 12489,
-  12509, 12510, 12511, 12518, 12527, 12541, 12545, 12551, 12582, 12583,
-  12587, 12597, 12601, 12611, 12625, 12626, 12631, 12650, 12653, 12655,
-  12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12724, 12734,
-  12738, 12746, 12766
+  11487, 11532, 11578, 11653, 11668, 11697, 11724, 11820, 11892, 11895,
+  11901, 11945, 11947, 11952, 11987, 12052, 12083, 12158, 12178, 12200,
+  12346, 12393, 12420, 12432, 12445, 12449, 12453, 12454, 12460, 12469,
+  12489, 12509, 12510, 12511, 12518, 12527, 12541, 12545, 12551, 12582,
+  12583, 12587, 12597, 12601, 12611, 12625, 12626, 12631, 12650, 12653,
+  12655, 12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12724,
+  12734, 12738, 12746, 12766
 
 * The RPC implementation in libc is obsoleted.  Old programs keep working
   but new programs cannot be linked with the routines in libc anymore.
diff --git a/stdlib/putenv.c b/stdlib/putenv.c
index 4e86934..d97eb54 100644
--- a/stdlib/putenv.c
+++ b/stdlib/putenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 94, 95, 96, 97, 98, 99, 11 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -57,14 +57,31 @@ putenv (string)
 
   if (name_end != NULL)
     {
+      char *name;
 #ifdef _LIBC
-      char *name = strndupa (string, name_end - string);
+      int use_malloc = !__libc_use_alloca (name_end - string + 1);
+      if (__builtin_expect (use_malloc, 0))
+	{
+	  name = strndup (string, name_end - string);
+	  if (name == NULL)
+	    return -1;
+	}
+      else
+	name = strndupa (string, name_end - string);
 #else
-      char *name = alloca (name_end - string + 1);
+# define use_malloc 1
+      name = malloc (name_end - string + 1);
+      if (name == NULL)
+	return -1;
       memcpy (name, string, name_end - string);
       name[name_end - string] = '\0';
 #endif
-      return __add_to_environ (name, NULL, string, 1);
+      int result = __add_to_environ (name, NULL, string, 1);
+
+      if (__builtin_expect (use_malloc, 0))
+	free (name);
+
+      return result;
     }
 
   __unsetenv (string);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |    4 ++++
 NEWS            |   14 +++++++-------
 stdlib/putenv.c |   25 +++++++++++++++++++++----
 3 files changed, 32 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]