diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2001-07-18 14:49:14 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2001-07-18 14:49:14 +0000 |
commit | 91a8487cb275d02a7a10a369575be6a8516d5597 (patch) | |
tree | a90c52535132a8818b254794162d407cac3b8bed /usr.bin/make | |
parent | ed6e49ee920653835b3ee83f2baaae25e31921f9 (diff) |
Avoid dumping core when reporting open conditionals.
Turns out that current is NULL when Parse_Fatal is called in this case,
so just do something sensible in error reporting functions when current is
NULL...
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/error.c | 5 | ||||
-rw-r--r-- | usr.bin/make/lowparse.c | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/make/error.c b/usr.bin/make/error.c index ddcc8c072a0..f2624f91dcd 100644 --- a/usr.bin/make/error.c +++ b/usr.bin/make/error.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: error.c,v 1.7 2001/05/29 12:17:05 espie Exp $ */ +/* $OpenBSD: error.c,v 1.8 2001/07/18 14:49:13 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -194,7 +194,8 @@ ParseVErrorInternal(va_alist) va_dcl #endif { - (void)fprintf(stderr, "\"%s\", line %lu: ", cfname, clineno); + if (cfname) + (void)fprintf(stderr, "\"%s\", line %lu: ", cfname, clineno); if (type == PARSE_WARNING) (void)fprintf(stderr, "warning: "); (void)vfprintf(stderr, fmt, ap); diff --git a/usr.bin/make/lowparse.c b/usr.bin/make/lowparse.c index 71922561d75..b82b66c735c 100644 --- a/usr.bin/make/lowparse.c +++ b/usr.bin/make/lowparse.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: lowparse.c,v 1.12 2001/07/11 12:59:43 espie Exp $ */ +/* $OpenBSD: lowparse.c,v 1.13 2001/07/18 14:49:13 espie Exp $ */ /* low-level parsing functions. */ @@ -430,13 +430,13 @@ Parse_ReadNormalLine(linebuf) unsigned long Parse_Getlineno() { - return current->lineno; + return current ? current->lineno : 0; } const char * Parse_Getfilename() { - return current->fname; + return current ? current->fname : NULL; } #ifdef CLEANUP |