svn commit: r249436 - head/sys/kern

Jayachandran C. jchandra at FreeBSD.org
Sat Apr 13 07:23:38 UTC 2013


Author: jchandra
Date: Sat Apr 13 07:23:37 2013
New Revision: 249436
URL: http://svnweb.freebsd.org/changeset/base/249436

Log:
  Fix changes made in r249408.
  
  In some cases, kern_envp is set by the architecture code and env_pos does
  not contain the length of the static kernel environment. In these cases
  r249408 causes the kernel to discard the environment.
  
  Fix this by updating the check for empty static env to *kern_envp != '\0'
  
  Reported by:	np@

Modified:
  head/sys/kern/kern_environment.c

Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c	Sat Apr 13 05:11:21 2013	(r249435)
+++ head/sys/kern/kern_environment.c	Sat Apr 13 07:23:37 2013	(r249436)
@@ -231,7 +231,7 @@ init_dynamic_kenv(void *data __unused)
 	kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV,
 		M_WAITOK | M_ZERO);
 	i = 0;
-	if (env_pos > 0) {
+	if (*kern_envp != '\0') {
 		for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
 			len = strlen(cp) + 1;
 			if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {


More information about the svn-src-all mailing list