Index: trunk/src/samhain.c
===================================================================
--- trunk/src/samhain.c	(revision 55)
+++ trunk/src/samhain.c	(revision 59)
@@ -652,4 +652,5 @@
   sh_files_delfilestack ();
   sh_hash_hashdelete();
+  sh_files_hle_reg (NULL);
 #endif
 #if defined(SH_WITH_SERVER)
@@ -1369,9 +1370,29 @@
     }
 
-  /* initialize signal handling etc
-   */
   if (sh.flag.isdaemon == S_TRUE)
     sh_error_only_stderr (BAD);
 
+  /* --- load database; checksum of database
+   */
+#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 
+  TPT((0, FIL__, __LINE__, _("msg=<Get checksum of the database.>\n")))
+  if (sh.flag.checkSum == SH_CHECK_CHECK) 
+    {
+      if (0 != sl_strcmp(file_path('D', 'R'), _("REQ_FROM_SERVER")))
+	{
+	  (void) sl_strlcpy(sh.data.hash,
+			    sh_tiger_hash (file_path('D', 'R'), 
+					   TIGER_FILE, 0), 
+			    KEY_LEN+1);
+	}
+
+      /* this eventually fetches the file from server to get checksum
+       */
+      sh_hash_init ();
+    }
+#endif
+
+  /* --- initialize signal handling etc.; fork daemon
+   */
   if (sh_unix_init(sh.flag.isdaemon) == -1) 
     {
@@ -1409,28 +1430,4 @@
 #if defined(INET_SYSLOG) && defined(SH_WITH_SERVER)
   create_syslog_socket (S_FALSE);
-#endif
-
-
-  /* checksum of database
-   */
-#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 
-  TPT((0, FIL__, __LINE__, _("msg=<Get checksum of the database.>\n")))
-  if (sh.flag.checkSum == SH_CHECK_CHECK) 
-    {
-      if (0 == sl_strcmp(file_path('D', 'R'), _("REQ_FROM_SERVER")))
-	{
-	  /* fetch the file from server to get checksum
-	   */
-	  sh_hash_init ();
-	  /* sh_hash_hashdelete (); */
-	}
-      else
-	{
-	  (void) sl_strlcpy(sh.data.hash,
-			    sh_tiger_hash (file_path('D', 'R'), 
-					   TIGER_FILE, 0), 
-			    KEY_LEN+1);
-	}
-    }
 #endif
 
Index: trunk/src/sh_unix.c
===================================================================
--- trunk/src/sh_unix.c	(revision 55)
+++ trunk/src/sh_unix.c	(revision 59)
@@ -2843,9 +2843,16 @@
   SL_ENTER(_("sh_unix_checksum_size"));
 
-  /* lookup file in database */
-  status = sh_hash_get_it (filename, &tmpFile);
-  if (status != 0) {
-    goto out;
-  }
+  if (sh.flag.checkSum != SH_CHECK_INIT)
+    {
+      /* lookup file in database */
+      status = sh_hash_get_it (filename, &tmpFile);
+      if (status != 0) {
+	goto out;
+      }
+    }
+  else
+    {
+      tmpFile.size = fbuf->st_size;
+    }
 
   /* if last < current get checksum */
@@ -2853,7 +2860,7 @@
     {
       sl_strlcpy(fileHash,
-		sh_tiger_generic_hash (filename, TIGER_FD, tmpFile.size, 
-				       alert_timeout),
-		KEY_LEN+1);
+		 sh_tiger_generic_hash (filename, TIGER_FD, tmpFile.size, 
+					alert_timeout),
+		 KEY_LEN+1);
 
       /* return */
