Don't strip a leading '/' from a pattern to be matched.

This aligns the pattern-matching behavior with GNU tar
and restores the behavior of bsdtar prior to FreeBSD 6.3.

PR:		bin/117909
MFC after:	3 days
This commit is contained in:
kientzle 2008-08-17 19:43:45 +00:00
parent ddd418aba1
commit 7fc341305a

View File

@ -118,8 +118,6 @@ add_pattern(struct bsdtar *bsdtar, struct match **list, const char *pattern)
match = malloc(sizeof(*match) + strlen(pattern) + 1);
if (match == NULL)
bsdtar_errc(bsdtar, 1, errno, "Out of memory");
if (pattern[0] == '/')
pattern++;
strcpy(match->pattern, pattern);
/* Both "foo/" and "foo" should match "foo/bar". */
if (match->pattern[strlen(match->pattern)-1] == '/')