Module Name: src
Committed By: sjg
Date: Fri Dec 21 05:50:19 UTC 2018
Modified Files:
src/usr.bin/make: var.c
Log Message:
unexport-env: avoid SEGFAULT if MAKELEVEL not in env
To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/usr.bin/make/var.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.220 src/usr.bin/make/var.c:1.221
--- src/usr.bin/make/var.c:1.220 Sun May 27 01:14:51 2018
+++ src/usr.bin/make/var.c Fri Dec 21 05:50:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $ */
+/* $NetBSD: var.c,v 1.221 2018/12/21 05:50:19 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.221 2018/12/21 05:50:19 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $");
+__RCSID("$NetBSD: var.c,v 1.221 2018/12/21 05:50:19 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -836,7 +836,8 @@ Var_UnExport(char *str)
environ = savedEnv = newenv;
newenv[0] = NULL;
newenv[1] = NULL;
- setenv(MAKE_LEVEL_ENV, cp, 1);
+ if (cp && *cp)
+ setenv(MAKE_LEVEL_ENV, cp, 1);
} else {
for (; *str != '\n' && isspace((unsigned char) *str); str++)
continue;