Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Dec 2009 23:27:24 +0000 (UTC)
From:      Sean Farley <scf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200191 - head/lib/libc/stdlib
Message-ID:  <200912062327.nB6NROLv034889@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scf
Date: Sun Dec  6 23:27:24 2009
New Revision: 200191
URL: http://svn.freebsd.org/changeset/base/200191

Log:
  Change the behavior of setenv(), putenv() and unsetenv() to continue parsing
  instead of returning an error if a corrupt (not a "name=value" string) entry
  in the environ array is detected when (re)-building the internal
  environment.  This should prevent applications or libraries from
  experiencing issues arising from the expectation that these calls will
  complete even with corrupt entries.  The behavior is now as it was prior to
  7.0.
  
  Reviewed by:	jilles
  MFC after:	1 week

Modified:
  head/lib/libc/stdlib/getenv.c

Modified: head/lib/libc/stdlib/getenv.c
==============================================================================
--- head/lib/libc/stdlib/getenv.c	Sun Dec  6 23:05:17 2009	(r200190)
+++ head/lib/libc/stdlib/getenv.c	Sun Dec  6 23:27:24 2009	(r200191)
@@ -361,8 +361,7 @@ __build_env(void)
 		} else {
 			__env_warnx(CorruptEnvValueMsg, envVars[envNdx].name,
 			    strlen(envVars[envNdx].name));
-			errno = EFAULT;
-			goto Failure;
+			continue;
 		}
 
 		/*
@@ -377,8 +376,7 @@ __build_env(void)
 		    false) == NULL) {
 			__env_warnx(CorruptEnvFindMsg, envVars[envNdx].name,
 			    nameLen);
-			errno = EFAULT;
-			goto Failure;
+			continue;
 		}
 		envVars[activeNdx].active = true;
 	}
@@ -560,8 +558,7 @@ __merge_environ(void)
 				if ((equals = strchr(*env, '=')) == NULL) {
 					__env_warnx(CorruptEnvValueMsg, *env,
 					    strlen(*env));
-					errno = EFAULT;
-					return (-1);
+					continue;
 				}
 				if (__setenv(*env, equals - *env, equals + 1,
 				    1) == -1)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912062327.nB6NROLv034889>