From: Emil Velikov Date: Tue, 8 Oct 2024 17:04:34 +0000 (+0100) Subject: libkmod: call fnmatch() only as needed X-Git-Tag: v34~251 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e79bba6b4af86216072b56382198da645a0906f4;p=thirdparty%2Fkmod.git libkmod: call fnmatch() only as needed Currently we'll call the function even when the patterns is an empty string. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/174 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c index 4280be8d..6fe019ae 100644 --- a/libkmod/libkmod-index.c +++ b/libkmod/libkmod-index.c @@ -511,7 +511,7 @@ static void index_searchwild__all(struct index_node_f *node, int j, struct strbu } } - if (node->values) { + if (pushed && node->values) { const char *s = strbuf_str(buf); if (s != NULL && fnmatch(s, subkey, 0) == 0) @@ -997,7 +997,7 @@ static void index_mm_searchwild_all(struct index_mm_node *node, int j, struct st } } - if (node->values.len > 0) { + if (pushed && node->values.len > 0) { const char *s = strbuf_str(buf); if (s != NULL && fnmatch(s, subkey, 0) == 0)