summaryrefslogtreecommitdiff
path: root/usr.bin/make/str.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2020-05-06 02:30:10 +0000
committerchristos <christos@NetBSD.org>2020-05-06 02:30:10 +0000
commit9a14dd9bc55901d9366dc37ca4cccfdd2eb9e1fa (patch)
tree0e1b432a8d7466cb26c53ed0653fbc5cc46cf4f5 /usr.bin/make/str.c
parent3fa68824cd7600a101fc6ee6feda31c020bb23b7 (diff)
Behave like gmake: empty string does not match % pattern
Diffstat (limited to 'usr.bin/make/str.c')
-rw-r--r--usr.bin/make/str.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c
index d6389bdbbe9..d3d7994a086 100644
--- a/usr.bin/make/str.c
+++ b/usr.bin/make/str.c
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.41 2020/05/03 12:10:28 rillig Exp $ */
+/* $NetBSD: str.c,v 1.42 2020/05/06 02:30:10 christos Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.41 2020/05/03 12:10:28 rillig Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.42 2020/05/06 02:30:10 christos Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90";
#else
-__RCSID("$NetBSD: str.c,v 1.41 2020/05/03 12:10:28 rillig Exp $");
+__RCSID("$NetBSD: str.c,v 1.42 2020/05/06 02:30:10 christos Exp $");
#endif
#endif /* not lint */
#endif
@@ -471,6 +471,10 @@ Str_SYSVMatch(const char *word, const char *pattern, size_t *len,
if ((m = strchr(p, '%')) != NULL) {
*hasPercent = TRUE;
+ if (*w == '\0') {
+ /* empty word does not match pattern */
+ return NULL;
+ }
/* check that the prefix matches */
for (; p != m && *w && *w == *p; w++, p++)
continue;