1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 14:18:06 +11:00

cfspack: apply fnmatch only to files

This commit is contained in:
Virgil Dupras 2019-06-02 16:46:12 -04:00
parent 8e2a89cea5
commit 58bdc6b27f

View File

@ -89,12 +89,6 @@ int spitdir(char *path, char *prefix, char *pattern)
fprintf(stderr, "Filename too long: %s/%s\n", prefix, ep->d_name); fprintf(stderr, "Filename too long: %s/%s\n", prefix, ep->d_name);
return 1; return 1;
} }
if (pattern) {
if (fnmatch(pattern, ep->d_name, FNM_EXTMATCH) != 0) {
continue;
}
}
char fullpath[0x1000]; char fullpath[0x1000];
strcpy(fullpath, path); strcpy(fullpath, path);
strcat(fullpath, "/"); strcat(fullpath, "/");
@ -111,6 +105,12 @@ int spitdir(char *path, char *prefix, char *pattern)
return r; return r;
} }
} else { } else {
if (pattern) {
if (fnmatch(pattern, ep->d_name, FNM_EXTMATCH) != 0) {
continue;
}
}
int r = spitblock(fullpath, newprefix); int r = spitblock(fullpath, newprefix);
if (r != 0) { if (r != 0) {
return r; return r;