Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6-1]: src/lib/libc/stdlib Pull up following revision(s) (requeste...
details: https://anonhg.NetBSD.org/src/rev/cf29ddaa1514
branches: netbsd-6-1
changeset: 775840:cf29ddaa1514
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sat Sep 14 13:45:13 2013 +0000
description:
Pull up following revision(s) (requested by tron in ticket #940):
lib/libc/stdlib/_env.c: revision 1.8
Don't scrub the environment unless we are going to change it. This should
prevent crashes in applications which carefully and manually construct
a temporary environment and later restore the original environment
like Emacs 24.
Problem reported by Thomas Klausner on "pkgsrc-users" mailing list.
diffstat:
lib/libc/stdlib/_env.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (40 lines):
diff -r bc6bb78fcf11 -r cf29ddaa1514 lib/libc/stdlib/_env.c
--- a/lib/libc/stdlib/_env.c Fri Sep 13 04:18:50 2013 +0000
+++ b/lib/libc/stdlib/_env.c Sat Sep 14 13:45:13 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _env.c,v 1.6 2011/10/06 20:31:41 christos Exp $ */
+/* $NetBSD: _env.c,v 1.6.16.1 2013/09/14 13:45:13 bouyer Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _env.c,v 1.6 2011/10/06 20:31:41 christos Exp $");
+__RCSID("$NetBSD: _env.c,v 1.6.16.1 2013/09/14 13:45:13 bouyer Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -256,10 +256,6 @@
size_t new_size, num_entries, required_size;
char **new_environ;
- /* Does the environ need scrubbing? */
- if (environ != allocated_environ && allocated_environ != NULL)
- __scrubenv();
-
/* Search for an existing environment variable of the given name. */
num_entries = 0;
while (environ[num_entries] != NULL) {
@@ -275,6 +271,10 @@
if (!allocate)
return -1;
+ /* Does the environ need scrubbing? */
+ if (environ != allocated_environ && allocated_environ != NULL)
+ __scrubenv();
+
/* Create a new slot in the environment. */
required_size = num_entries + 1;
if (environ == allocated_environ &&
Home |
Main Index |
Thread Index |
Old Index