Module Name: src
Committed By: tron
Date: Sun Nov 14 20:37:02 UTC 2010
Modified Files:
src/lib/libc/stdlib: getenv.c
Log Message:
Set errno to ENOENT if we reject the environment variable name in
getenv_r() instead of leaving it unchanged.
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/stdlib/getenv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdlib/getenv.c
diff -u src/lib/libc/stdlib/getenv.c:1.33 src/lib/libc/stdlib/getenv.c:1.34
--- src/lib/libc/stdlib/getenv.c:1.33 Sun Nov 14 18:11:43 2010
+++ src/lib/libc/stdlib/getenv.c Sun Nov 14 20:37:02 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: getenv.c,v 1.33 2010/11/14 18:11:43 tron Exp $ */
+/* $NetBSD: getenv.c,v 1.34 2010/11/14 20:37:02 tron Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getenv.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: getenv.c,v 1.33 2010/11/14 18:11:43 tron Exp $");
+__RCSID("$NetBSD: getenv.c,v 1.34 2010/11/14 20:37:02 tron Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -87,8 +87,10 @@
_DIAGASSERT(name != NULL);
l_name = __envvarnamelen(name, false);
- if (l_name == 0)
+ if (l_name == 0) {
+ errno = ENOENT;
return -1;
+ }
rv = -1;
if (__readlockenv()) {