From 9c86db05efd14d8e5bca20ec2f7a574f06e14205 Mon Sep 17 00:00:00 2001 From: kientzle Date: Wed, 2 Jun 2004 07:23:54 +0000 Subject: [PATCH] Both "foo/" and "foo" should match "foo/bar", so strip trailing '/' characters on include patterns for extraction. Pointed out by: games/quakeforge port (thanks to Kris!) --- usr.bin/tar/matching.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.bin/tar/matching.c b/usr.bin/tar/matching.c index 6a3f65bd036e..2ba755fe94a2 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;