Index: trunk/src/sh_hash.c
===================================================================
--- trunk/src/sh_hash.c	(revision 107)
+++ trunk/src/sh_hash.c	(revision 114)
@@ -290,7 +290,5 @@
   char           * linkpath;
   char           * attr_string;
-  int              visited;
-  int              reported;
-  int              allignore;
+  int              fflags;
   unsigned long    modi_mask;
   struct           file_info * next;
@@ -487,21 +485,22 @@
     }
 
-  /* Kernel info
+  /* Not a fully qualified path, i.e. some info stored by some module
    */
-  if (p->fullpath[0] == 'K')
+  if (p->fullpath[0] != '/')
     {
       SL_RET0(_("hash_unvisited"));
     }
 
-  /* visited   = FALSE: not seen; 
-   * visited   = 99:    not seen, and already checked 
-   * reported  = FALSE: not reported yet
-   * allignore = FALSE: not under IgnoreAll
+  /* visited   flag not set: not seen; 
+   * checked   flag     set: not seen (i.e. missing), and already checked 
+   * reported  flag not set: not reported yet
+   * allignore flag not set: not under IgnoreAll
    *
    * Files/directories under IgnoreAll are noticed as missing already
    * during the file check.
    */
-  if ((p->visited == S_FALSE || p->visited == 99) && p->reported == S_FALSE 
-      && p->allignore == S_FALSE)
+  if (((!SH_FFLAG_VISITED_SET(p->fflags)) || SH_FFLAG_CHECKED_SET(p->fflags)) 
+      && (!SH_FFLAG_REPORTED_SET(p->fflags))
+      && (!SH_FFLAG_ALLIGNORE_SET(p->fflags)))
     {
       i = retry_lstat(FIL__, __LINE__, p->fullpath, &buf);
@@ -520,5 +519,8 @@
 	      SH_FREE(ptr);
 	    }
-	  if (p->visited != 99)
+
+	  /* Only report if !SH_FFLAG_CHECKED_SET
+	   */
+	  if (!SH_FFLAG_CHECKED_SET(p->fflags))
 	    {
 	      if (S_FALSE == sh_ignore_chk_del(p->fullpath))
@@ -572,5 +574,5 @@
 	      SL_RET0(_("hash_unvisited"));
 #else
-	      p->reported = S_TRUE; 
+	      SET_SH_FFLAG_REPORTED(p->fflags); 
 #endif
 	    }
@@ -578,6 +580,6 @@
     }
 
-  else if (p->visited == S_TRUE && p->reported == S_TRUE 
-	   && p->allignore == S_FALSE)
+  else if (SH_FFLAG_VISITED_SET(p->fflags) && SH_FFLAG_REPORTED_SET(p->fflags) 
+	   && (!SH_FFLAG_ALLIGNORE_SET(p->fflags)))
     {
       if (S_FALSE == sh_ignore_chk_new(p->fullpath))
@@ -597,11 +599,13 @@
 	}
 
-      p->reported = S_FALSE;
+      CLEAR_SH_FFLAG_REPORTED(p->fflags);
     }
 
   if (sh.flag.reportonce == S_FALSE)
-    p->reported = S_FALSE;
-
-  p->visited = S_FALSE;
+    CLEAR_SH_FFLAG_REPORTED(p->fflags);
+
+  CLEAR_SH_FFLAG_VISITED(p->fflags);
+  CLEAR_SH_FFLAG_CHECKED(p->fflags);
+
   SL_RET0(_("hash_unvisited"));
 }
@@ -1049,7 +1053,7 @@
 
   memcpy( &(*p).theFile, &ft, sizeof(sh_filestore_t) );
-  p->visited   = S_FALSE;
-  p->reported  = S_FALSE;
-  p->allignore = S_FALSE;
+
+  p->fflags = 0;
+
   p->modi_mask = 0L;
   p->fullpath  = fullpath;
@@ -1835,5 +1839,5 @@
 
   if (!p) return (-1);
-  if (p->allignore == S_FALSE && 
+  if ((!SH_FFLAG_ALLIGNORE_SET(p->fflags)) && 
       (p->modi_mask & MODI_CHK) != 0 &&
       (p->modi_mask & MODI_MOD) != 0)
@@ -1883,13 +1887,19 @@
   if (p == NULL) 
     SL_RETURN((-1), _("sh_hash_set_visited_int"));
-  if (flag == 99)
-    {
-      p->visited  = 99;
-      p->reported = S_FALSE;
-    }
-  else
-    {
-      p->visited  = S_TRUE;
-      p->reported = flag;
+
+  if (flag == SH_FFLAG_CHECKED)
+    {
+      CLEAR_SH_FFLAG_REPORTED(p->fflags);
+      CLEAR_SH_FFLAG_VISITED(p->fflags);
+      SET_SH_FFLAG_CHECKED(p->fflags);
+    }
+  else
+    {
+      SET_SH_FFLAG_VISITED(p->fflags);
+      CLEAR_SH_FFLAG_CHECKED(p->fflags);
+      if (flag == SH_FFLAG_REPORTED)
+	SET_SH_FFLAG_REPORTED(p->fflags);
+      else
+	CLEAR_SH_FFLAG_REPORTED(p->fflags);
     }
   SL_RETURN((0), _("sh_hash_set_visited_int"));
@@ -1903,21 +1913,26 @@
   int i;
   SL_ENTER(_("sh_hash_set_visited"));
-  i = sh_hash_set_visited_int(newname, 99);
+  i = sh_hash_set_visited_int(newname, SH_FFLAG_CHECKED);
   SL_RETURN(i, _("sh_hash_set_visited"));
 }
 
+/* mark the file as visited and reported
+ */
 int sh_hash_set_visited (char * newname)
 {
   int i;
   SL_ENTER(_("sh_hash_set_visited"));
-  i = sh_hash_set_visited_int(newname, S_TRUE);
+  i = sh_hash_set_visited_int(newname, SH_FFLAG_REPORTED);
   SL_RETURN(i, _("sh_hash_set_visited"));
 }
 
+/* mark the file as visited and NOT reported
+ * used to avoid deletion of file from internal database
+ */
 int sh_hash_set_visited_true (char * newname)
 {
   int i;
   SL_ENTER(_("sh_hash_set_visited_true"));
-  i = sh_hash_set_visited_int(newname, S_FALSE);
+  i = sh_hash_set_visited_int(newname, 0);
   SL_RETURN(i, _("sh_hash_set_visited_true"));
 }
@@ -2091,7 +2106,5 @@
 
   memcpy( &(*fp).theFile, &p, sizeof(sh_filestore_t) );
-  fp->visited   = S_FALSE;
-  fp->reported  = S_FALSE;
-  fp->allignore = S_FALSE;
+  fp->fflags    = 0;
   fp->modi_mask = 0L;
 
@@ -2599,7 +2612,11 @@
 
       if (p)
-	p->visited   = S_TRUE;
+	{
+	  SET_SH_FFLAG_VISITED(p->fflags);
+	  CLEAR_SH_FFLAG_CHECKED(p->fflags);
+	}
+
       if (sh.flag.reportonce == S_TRUE)
-	theFile->reported = S_TRUE;
+	SET_SH_FFLAG_REPORTED(theFile->file_reported);
 
       if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -2828,5 +2845,5 @@
   /* --- Report on modified files. ---
    */
-  if (modi_mask != 0 && p->reported == S_FALSE)
+  if (modi_mask != 0 && (!SH_FFLAG_REPORTED_SET(p->fflags)))
     { 
       tmp = SH_ALLOC(SH_BUFSIZE);
@@ -3188,5 +3205,5 @@
 
 #ifndef REPLACE_OLD
-      p->reported = S_TRUE;
+      SET_SH_FFLAG_REPORTED(p->fflags);
 #endif
 
@@ -3247,5 +3264,6 @@
 	      theFile->hardlinks = p->theFile.hardlinks;
 	      
-	      p->visited = S_TRUE;
+	      SET_SH_FFLAG_VISITED(p->fflags);
+	      CLEAR_SH_FFLAG_CHECKED(p->fflags);
 	      SL_RETURN(1, _("sh_hash_compdata"));
 	    }
@@ -3316,5 +3334,6 @@
     }
 
-  p->visited = S_TRUE;
+  SET_SH_FFLAG_VISITED(p->fflags);
+  CLEAR_SH_FFLAG_CHECKED(p->fflags);
 
   SL_RETURN(0, _("sh_hash_compdata"));
@@ -3334,5 +3353,5 @@
     {
       for (p = tab[i]; p; p = p->next)
-	p->allignore  = S_FALSE;
+	CLEAR_SH_FFLAG_ALLIGNORE(p->fflags);
     }
   SL_RETURN (0, _("sh_hash_compdata"));
@@ -3362,5 +3381,5 @@
 	  if (p->fullpath && 0 == strncmp(s, p->fullpath, len))
 	    { 
-	      p->allignore  = S_TRUE;
+	      SET_SH_FFLAG_ALLIGNORE(p->fflags);
 	    }
 	}
