Index: trunk/src/sh_files.c
===================================================================
--- trunk/src/sh_files.c	(revision 396)
+++ trunk/src/sh_files.c	(revision 397)
@@ -2788,30 +2788,32 @@
       *reported   = item->is_reported;
       retval = 1;
-      goto out;
-    }
+    }
+  SH_MUTEX_UNLOCK(mutex_zfiles);
 
 #if defined(HAVE_GLOB_H) && defined(HAVE_FNMATCH_H)
-  SH_MUTEX_LOCK(mutex_zglob);
-  for (testPattern = (sh_globstack_t *) zAVLFirst (&cursor, zglobList); 
-       testPattern;
-       testPattern = (sh_globstack_t *) zAVLNext  (&cursor))
-    {
-      if (testPattern->type == SH_LIST_FILE)
+  if (retval == 0)
+    {
+      SH_MUTEX_LOCK(mutex_zglob);
+      for (testPattern = (sh_globstack_t *) zAVLFirst (&cursor, zglobList); 
+	   testPattern;
+	   testPattern = (sh_globstack_t *) zAVLNext  (&cursor))
 	{
-	  if (0 == fnmatch(testPattern->name, name, FNM_PATHNAME|FNM_PERIOD))
+	  if (testPattern->type == SH_LIST_FILE)
 	    {
-	      *check_mask = testPattern->check_mask;
-	      *class      = testPattern->class;
-	      retval = 1;
-	      break;
+	      if (0 == fnmatch(testPattern->name, name, 
+			       FNM_PATHNAME|FNM_PERIOD))
+		{
+		  *check_mask = testPattern->check_mask;
+		  *class      = testPattern->class;
+		  retval = 1;
+		  break;
+		}
+	      
 	    }
-	
 	}
-    }
-  SH_MUTEX_UNLOCK(mutex_zglob);
-#endif
- out:
-  ; /* 'label at end of compound statement' */
-  SH_MUTEX_UNLOCK(mutex_zfiles);
+      SH_MUTEX_UNLOCK(mutex_zglob);
+    }
+#endif
+
   return retval;
 }
