* src/names.c (all_names_found): Exempt wildcard entries from hierarchy
checking.
This commit is contained in:
Sergey Poznyakoff
2025-06-02 07:22:53 +03:00
parent 4303066730
commit 7c4f8fb579

View File

@@ -1407,8 +1407,9 @@ name_match (const char *file_name)
The decision is postponed until the next entry is read if: The decision is postponed until the next entry is read if:
1) P ended with a slash (i.e. it was a directory) 1) P ended with a slash (i.e. it was a directory)
2) P matches any entry from the namelist *and* represents a subdirectory 2) P matches a non-wildcard entry from the namelist *and* represents a
or a file lying under this entry (in the terms of directory structure). subdirectory or a file lying under this entry (in the terms of directory
structure).
This is necessary to handle contents of directories. */ This is necessary to handle contents of directories. */
bool bool
@@ -1420,7 +1421,8 @@ all_names_found (struct tar_stat_info *p)
for (struct name const *cursor = namelist; cursor; cursor = cursor->next) for (struct name const *cursor = namelist; cursor; cursor = cursor->next)
{ {
if ((cursor->name[0] && !wasfound (cursor)) if ((cursor->name[0] && !wasfound (cursor))
|| (len >= cursor->length && ISSLASH (p->file_name[cursor->length]))) || (!cursor->is_wildcard &&
len >= cursor->length && ISSLASH (p->file_name[cursor->length])))
return false; return false;
} }
return true; return true;