From 58bdc6b27f78d3df97164173578091ead0590999 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 2 Jun 2019 16:46:12 -0400 Subject: [PATCH] cfspack: apply fnmatch only to files --- tools/cfspack/cfspack.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/cfspack/cfspack.c b/tools/cfspack/cfspack.c index 009b067..9e9094f 100644 --- a/tools/cfspack/cfspack.c +++ b/tools/cfspack/cfspack.c @@ -89,12 +89,6 @@ int spitdir(char *path, char *prefix, char *pattern) fprintf(stderr, "Filename too long: %s/%s\n", prefix, ep->d_name); return 1; } - if (pattern) { - if (fnmatch(pattern, ep->d_name, FNM_EXTMATCH) != 0) { - continue; - } - } - char fullpath[0x1000]; strcpy(fullpath, path); strcat(fullpath, "/"); @@ -111,6 +105,12 @@ int spitdir(char *path, char *prefix, char *pattern) return r; } } else { + if (pattern) { + if (fnmatch(pattern, ep->d_name, FNM_EXTMATCH) != 0) { + continue; + } + } + int r = spitblock(fullpath, newprefix); if (r != 0) { return r;