summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar/matching.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tar/matching.c')
-rw-r--r--usr.bin/tar/matching.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/tar/matching.c b/usr.bin/tar/matching.c
index 6a3f65b..2ba755f 100644
--- a/usr.bin/tar/matching.c
+++ b/usr.bin/tar/matching.c
@@ -102,6 +102,9 @@ add_pattern(struct bsdtar *bsdtar, struct match **list, const char *pattern)
if (pattern[0] == '/')
pattern++;
strcpy(match->pattern, pattern);
+ /* Both "foo/" and "foo" should match "foo/bar". */
+ if (match->pattern[strlen(match->pattern)-1] == '/')
+ match->pattern[strlen(match->pattern)-1] = '\0';
match->next = *list;
*list = match;
match->matches = 0;
OpenPOWER on IntegriCloud