Index: /trunk/docs/Changelog
===================================================================
--- /trunk/docs/Changelog	(revision 91)
+++ /trunk/docs/Changelog	(revision 92)
@@ -1,3 +1,5 @@
 2.3.2:
+	* move file descriptor closing more towards program startup
+	* fix samhain_hide module (in-)compatibility with recent kernels
 	* fix regression in full stealth mode (incorrect comparison of
 	  bytes read vs. maximum capacity), reported by B. Fleming
Index: /trunk/include/kern_head.h
===================================================================
--- /trunk/include/kern_head.h	(revision 91)
+++ /trunk/include/kern_head.h	(revision 92)
@@ -780,5 +780,12 @@
   "_sys___semctl",	   /* 295  */
   "_sys_shmctl",	   /* 296  */
-  "_sys_msgctl",       /*	297 */
+  "_sys_msgctl",           /* 297  */
+  "_sys_sched_yield",      /* 298  */
+  "_sys_getthrid",         /* 299  */
+  "_sys_thrsleep",         /* 300  */
+  "_sys_thrwakeup",        /* 301  */
+  "_sys_threxit",          /* 302  */
+  "_sys_thrsigdivert",     /* 303  */
+  "_sys___getcwd",         /* 304  */
   NULL
 };
Index: /trunk/src/kern_head.c
===================================================================
--- /trunk/src/kern_head.c	(revision 91)
+++ /trunk/src/kern_head.c	(revision 92)
@@ -726,4 +726,6 @@
   if      (utbuf.release[0] == '3')
     which = 38;
+  else if (utbuf.release[0] == '4')
+    which = 40;
 #else
   if      (utbuf.release[0] == '4')
@@ -791,5 +793,5 @@
     printf("\n/* Kernel %s, machine %s -- use table %s */\n\n",
                  utbuf.release, utbuf.machine, "callz_fbsd5");
-  else if (which == 38)
+  else if (which == 38 || which == 40)
     printf("\n/* Kernel %s, machine %s -- use table %s */\n\n",
                  utbuf.release, utbuf.machine, "callz_obsd");
@@ -817,5 +819,5 @@
       }
   }
-  else if (which == 38) {
+  else if (which == 38 || which == 40) {
     while ((callz_obsd[i] != NULL) && (i < SYS_MAXSYSCALL))
       {
Index: /trunk/src/samhain.c
===================================================================
--- /trunk/src/samhain.c	(revision 91)
+++ /trunk/src/samhain.c	(revision 92)
@@ -914,5 +914,5 @@
       default:
 	times = 0;
-	while (times < 120) {
+	while (times < 300) {
 	  respid = waitpid(pid, &status, WNOHANG|WUNTRACED);
 	  if ((pid_t)-1 == respid)
@@ -1122,4 +1122,9 @@
   SL_ENTER(_("main"));
 
+  /* --- Close all but first three file descriptors. ---
+   */
+  sh_unix_closeall(3, -1); /* at program start */
+
+
   if (argc >= 2 && 0 != getuid() &&
       (0 == strcmp(argv[1], _("start")) ||
@@ -1311,9 +1316,4 @@
   sh.flag.opts = S_FALSE;
   
-
-  /* close all other files
-   */
-  sh_unix_closeall(3, -1); /* after processing CL options; only stderr here */
-
 
   /* --- Get user info. ---
Index: /trunk/src/sh_unix.c
===================================================================
--- /trunk/src/sh_unix.c	(revision 91)
+++ /trunk/src/sh_unix.c	(revision 92)
@@ -1849,7 +1849,9 @@
   if (goDaemon == 1)
     {
-      /* close all file descriptors 
+      /* Close first tree file descriptors 
        */ 
-      sh_unix_closeall (0, -1);  /* if running as daemon */
+      close (0);  /* if running as daemon */
+      close (1);  /* if running as daemon */
+      close (2);  /* if running as daemon */
 
       /* Enable full error logging
@@ -1913,5 +1915,4 @@
   else
     {
-      sh_unix_closeall(3, -1);  /* if not daemon */
       sh_error_enable_unsafe (S_TRUE);
 #if defined(HAVE_LIBPRELUDE)
