Index: /trunk/src/sh_files.c
===================================================================
--- /trunk/src/sh_files.c	(revision 504)
+++ /trunk/src/sh_files.c	(revision 505)
@@ -1175,4 +1175,5 @@
 typedef struct globstack_entry {
   char                  * name;
+  char                  * type_name;
   int                     class;
   unsigned long           check_flags;
@@ -1184,4 +1185,11 @@
 static zAVLTree * zglobList   = NULL;
 
+zAVLKey zglobstack_key (void const * arg)
+{
+  const sh_globstack_t * sa = (const sh_globstack_t *) arg;
+  return (zAVLKey) sa->type_name;
+}
+
+
 static int sh_files_pushglob (int class, int type, const char * p, int rdepth,
 			       unsigned long check_flags_in, int flag)
@@ -1199,44 +1207,48 @@
   globstatus    = glob (p, 0, sh_files_globerr, &pglob);
   
+  if (sh.flag.checkSum != SH_CHECK_INIT)
+    {
+      sh_globstack_t * new_item_ptr;
+      char  * fileName;
+      char  * typeName;
+      int     ret;
+      
+      SH_MUTEX_TRYLOCK(mutex_zfiles);
+      fileName = sh_util_strdup (p);
+      typeName = sh_util_strconcat ((type == SH_LIST_FILE) ? "F" : "D", p, NULL);
+      
+      new_item_ptr = (sh_globstack_t *) SH_ALLOC (sizeof(sh_globstack_t));
+      
+      new_item_ptr->name           = fileName;
+      new_item_ptr->type_name      = typeName;
+      new_item_ptr->class          = class;
+      new_item_ptr->check_flags    = check_flags;
+      new_item_ptr->rdepth         = rdepth;
+      new_item_ptr->type           = type;
+      
+      if (zglobList == NULL)
+	{
+	  zglobList = zAVLAllocTree (zglobstack_key, zAVL_KEY_STRING);
+	  if (zglobList == NULL) 
+	    {
+	      (void) safe_logger (0, 0, NULL);
+	      aud__exit(FIL__, __LINE__, EXIT_FAILURE);
+	    }
+	}
+      
+      ret = zAVLInsert (zglobList, new_item_ptr);
+      
+      if (ret != 0) /* already in list */
+	{
+	  SH_FREE(fileName);
+	  SH_FREE(typeName);
+	  SH_FREE(new_item_ptr);
+	}
+      SH_MUTEX_TRYLOCK_UNLOCK(mutex_zfiles);
+    }
+
+
   if (globstatus == 0 && pglob.gl_pathc > 0)
     {
-
-      if (sh.flag.checkSum != SH_CHECK_INIT)
-	{
-	  sh_globstack_t * new_item_ptr;
-	  char  * fileName;
-	  int     ret;
-	  
-	  SH_MUTEX_TRYLOCK(mutex_zfiles);
-	  fileName = sh_util_strdup (p);
-	  
-	  new_item_ptr = (sh_globstack_t *) SH_ALLOC (sizeof(sh_globstack_t));
-	  
-	  new_item_ptr->name           = fileName;
-	  new_item_ptr->class          = class;
-	  new_item_ptr->check_flags     = check_flags;
-	  new_item_ptr->rdepth         = rdepth;
-	  new_item_ptr->type           = type;
-	  
-	  if (zglobList == NULL)
-	    {
-	      zglobList = zAVLAllocTree (zdirstack_key, zAVL_KEY_STRING);
-	      if (zglobList == NULL) 
-		{
-		  (void) safe_logger (0, 0, NULL);
-		  aud__exit(FIL__, __LINE__, EXIT_FAILURE);
-		}
-	    }
-      
-	  ret = zAVLInsert (zglobList, new_item_ptr);
-
-	  if (ret != 0) /* already in list */
-	    {
-	      SH_FREE(fileName);
-	      SH_FREE(new_item_ptr);
-	    }
-	  SH_MUTEX_TRYLOCK_UNLOCK(mutex_zfiles);
-	}
-
       for (gloop = 0; gloop < (unsigned int) pglob.gl_pathc; ++gloop)
 	{
@@ -1351,4 +1363,6 @@
   if (here->name != NULL)
     SH_FREE(here->name);
+  if (here->type_name != NULL)
+    SH_FREE(here->type_name);
   SH_FREE(here);
   SL_RET0(_("free_globstack"));
