summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar/matching.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-06-02 07:23:54 +0000
committerkientzle <kientzle@FreeBSD.org>2004-06-02 07:23:54 +0000
commit3ffc90b560a0f46e439839c850b49068fac69e17 (patch)
treeb518930bd32211a9ef0a42c9065b17fe1533802f /usr.bin/tar/matching.c
parentd88857d6805f38355b8ad4fb029972a31db175fe (diff)
downloadFreeBSD-src-3ffc90b560a0f46e439839c850b49068fac69e17.zip
FreeBSD-src-3ffc90b560a0f46e439839c850b49068fac69e17.tar.gz
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!)
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