summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2017-06-21 00:11:37 +0000
committerMarc Espie <espie@cvs.openbsd.org>2017-06-21 00:11:37 +0000
commite779e70773772cffe1969266ee8ebc25ce19229a (patch)
tree956f184f714ec6c8f960d522b85bf6d2126a2720
parent81daee26df17fbbf2ca48b173b98f0aacdf3aa0d (diff)
error out if an exists condition tests an empty path, because that makes
zero sense. this would have caught DEPENDSFILE in gnu/cc/cc_tools okay guenther@, also tested by krw@
-rw-r--r--usr.bin/make/cond.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index 588784284b1..41ff09a9857 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cond.c,v 1.51 2016/10/21 16:12:38 espie Exp $ */
+/* $OpenBSD: cond.c,v 1.52 2017/06/21 00:11:36 espie Exp $ */
/* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */
/*
@@ -292,6 +292,9 @@ CondDoExists(struct Name *arg)
bool result;
char *path;
+ if (arg->s == arg->e)
+ Parse_Error(PARSE_FATAL, "Empty file name in .if exists()");
+
path = Dir_FindFilei(arg->s, arg->e, defaultPath);
if (path != NULL) {
result = true;