Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make unexport-env: avoid SEGFAULT if MAKELEVEL not i...



details:   https://anonhg.NetBSD.org/src/rev/292ce93a47c6
branches:  trunk
changeset: 446822:292ce93a47c6
user:      sjg <sjg%NetBSD.org@localhost>
date:      Fri Dec 21 05:50:19 2018 +0000

description:
unexport-env: avoid SEGFAULT if MAKELEVEL not in env

diffstat:

 usr.bin/make/var.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 63939c5ce4e6 -r 292ce93a47c6 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Fri Dec 21 04:43:17 2018 +0000
+++ b/usr.bin/make/var.c        Fri Dec 21 05:50:19 2018 +0000
@@ -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 @@
        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;



Home | Main Index | Thread Index | Old Index