Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdlib Retain old variables when failed to allocate...
details: https://anonhg.NetBSD.org/src/rev/b3e86b0a60c6
branches: trunk
changeset: 749545:b3e86b0a60c6
user: enami <enami%NetBSD.org@localhost>
date: Wed Dec 02 09:34:51 2009 +0000
description:
Retain old variables when failed to allocate memory.
diffstat:
lib/libc/stdlib/setenv.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (30 lines):
diff -r 8e8409682a0e -r b3e86b0a60c6 lib/libc/stdlib/setenv.c
--- a/lib/libc/stdlib/setenv.c Wed Dec 02 09:03:13 2009 +0000
+++ b/lib/libc/stdlib/setenv.c Wed Dec 02 09:34:51 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setenv.c,v 1.31 2008/11/01 00:54:47 christos Exp $ */
+/* $NetBSD: setenv.c,v 1.32 2009/12/02 09:34:51 enami Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setenv.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: setenv.c,v 1.31 2008/11/01 00:54:47 christos Exp $");
+__RCSID("$NetBSD: setenv.c,v 1.32 2009/12/02 09:34:51 enami Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -103,9 +103,9 @@
continue;
size = cc - name;
/* name + `=' + value */
- if ((environ[offset] = malloc(size + l_value + 2)) == NULL)
+ if ((c = malloc(size + l_value + 2)) == NULL)
goto bad;
- c = environ[offset];
+ environ[offset] = c;
(void)memcpy(c, name, size);
c += size;
*c++ = '=';
Home |
Main Index |
Thread Index |
Old Index