summaryrefslogtreecommitdiff
path: root/usr.bin/make/parse.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2007-01-15 01:26:32 +0000
committerchristos <christos@NetBSD.org>2007-01-15 01:26:32 +0000
commit66fbdf93198ed15996f1cac1b520aabfda44d2da (patch)
tree946afe2efa279b613c59ed99c97eee38568e08d5 /usr.bin/make/parse.c
parentb5da39fea6f83a0693ec3d977308b5954d840366 (diff)
Avoid coredumping. Found by accidentally running make instead of gmake
in java's control/make directory.
Diffstat (limited to 'usr.bin/make/parse.c')
-rw-r--r--usr.bin/make/parse.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 2fc88c10606..d3aabd73a89 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.128 2007/01/02 23:22:37 dsl Exp $ */
+/* $NetBSD: parse.c,v 1.129 2007/01/15 01:26:32 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.128 2007/01/02 23:22:37 dsl Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.129 2007/01/15 01:26:32 christos Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: parse.c,v 1.128 2007/01/02 23:22:37 dsl Exp $");
+__RCSID("$NetBSD: parse.c,v 1.129 2007/01/15 01:26:32 christos Exp $");
#endif
#endif /* not lint */
#endif
@@ -2454,11 +2454,13 @@ Parse_File(const char *name, int fd)
* in a dependency spec, add the command to the list of
* commands of all targets in the dependency spec
*/
- cp = estrdup(cp);
- Lst_ForEach(targets, ParseAddCmd, cp);
+ if (targets) {
+ cp = estrdup(cp);
+ Lst_ForEach(targets, ParseAddCmd, cp);
#ifdef CLEANUP
- Lst_AtEnd(targCmds, cp);
+ Lst_AtEnd(targCmds, cp);
#endif
+ }
}
continue;
}