diff --git a/gio/xdgmime/xdgmimecache.c b/gio/xdgmime/xdgmimecache.c
index 97fe975..f425b06 100644
--- a/gio/xdgmime/xdgmimecache.c
+++ b/gio/xdgmime/xdgmimecache.c
@@ -537,7 +541,7 @@ cache_glob_lookup_suffix (const char *file_name,
 			  MimeWeight  mime_types[],
 			  int         n_mime_types)
 {
-  int i, n;
+  int i, n = 0;
 
   for (i = 0; _caches[i]; i++)
     {
@@ -547,17 +551,15 @@ cache_glob_lookup_suffix (const char *file_name,
       xdg_uint32_t n_entries = GET_UINT32 (cache->buffer, list_offset);
       xdg_uint32_t offset = GET_UINT32 (cache->buffer, list_offset + 4);
 
-      n = cache_glob_node_lookup_suffix (cache, 
+      n += cache_glob_node_lookup_suffix (cache, 
 					 n_entries, offset, 
 					 file_name, len,
 					 ignore_case,
 					 mime_types,
 					 n_mime_types);
-      if (n > 0)
-	return n;
     }
 
-  return 0;
+  return n;
 }
 
 static int compare_mime_weight (const void *a, const void *b)

