Index: trunk/src/cutest_sh_tiger0.c
===================================================================
--- trunk/src/cutest_sh_tiger0.c	(revision 169)
+++ trunk/src/cutest_sh_tiger0.c	(revision 170)
@@ -10,9 +10,9 @@
 
 #if defined(HAVE_PTHREAD) && defined(SH_STEALTH)
-extern void sh_g_init();
+extern void sh_g_init(void);
 #endif
 
 
-static void init() {
+static void init(void) {
 
   extern unsigned char TcpFlag[8][PW_LEN+1];
Index: trunk/src/samhain.c
===================================================================
--- trunk/src/samhain.c	(revision 169)
+++ trunk/src/samhain.c	(revision 170)
@@ -167,5 +167,5 @@
 }
 
-void sh_g_init()
+void sh_g_init(void)
 {
   if (0 != pthread_key_create(&g_key, sh_g_destroy))
@@ -695,5 +695,5 @@
 #endif
 #if defined(SH_WITH_SERVER)
-  extern int sh_socket_remove ();
+  extern int sh_socket_remove (void);
 #endif
 
@@ -800,27 +800,18 @@
 #if defined(__linux__) || defined(sun) || defined(__sun) || defined(__sun__)
 #include <dirent.h>
-static pid_t * procdirSamhain ()
+static pid_t * procdirSamhain (void)
 {
-  volatile pid_t        * pidlist = malloc(sizeof(pid_t) * 65535);
-  pid_t        * dummy;
+  pid_t        * pidlist;
   struct dirent * d;
   DIR *        dp;
   long         ino;
   struct stat  buf;
-  int          i = 0;
+  int          i;
   pid_t        pid, mypid = getpid();
   char       * tail;
   char         exef[128];
 
-  if (!pidlist)
-    return NULL;
-
-  for (i = 0; i < 65535; ++i) pidlist[i] = 0;
-  i = 0;
-
   if (0 != stat(SH_INSTALL_PATH, &buf))
     {
-      dummy = (pid_t *)pidlist;
-      free(dummy);
       return NULL;
     }
@@ -830,6 +821,4 @@
   if (NULL == (dp = opendir("/proc")))
     {
-      dummy = (pid_t *)pidlist;
-      free(dummy);
       return NULL;
     }
@@ -837,4 +826,11 @@
   SH_MUTEX_LOCK(mutex_readdir);
 
+  pidlist =  malloc(sizeof(pid_t) * 65535);
+  if (!pidlist)
+    goto unlock_and_out;
+
+  for (i = 0; i < 65535; ++i) pidlist[i] = 0;
+
+  i = 0;
   while (NULL != (d = readdir(dp)) && i < 65535)
     {
@@ -858,11 +854,13 @@
     }
 
+ unlock_and_out:
+  ;
   SH_MUTEX_UNLOCK(mutex_readdir);
 
   closedir(dp);
-  return (pid_t *)pidlist;
+  return pidlist;
 }
 #else
-static pid_t * procdirSamhain ()
+static pid_t * procdirSamhain (void)
 {
   return NULL;
@@ -1191,5 +1189,5 @@
 #endif
 #if defined(SH_WITH_SERVER)
-  extern int    sh_create_tcp_socket();
+  extern int    sh_create_tcp_socket(void);
 #endif
 
@@ -1208,5 +1206,5 @@
 
   volatile time_t        told;
-  time_t        tcurrent;
+  volatile time_t        tcurrent;
   size_t        tzlen;
   char *        tzptr;
Index: trunk/src/samhain_setpwd.c
===================================================================
--- trunk/src/samhain_setpwd.c	(revision 169)
+++ trunk/src/samhain_setpwd.c	(revision 170)
@@ -231,4 +231,5 @@
   int    oldf;
   int    newf;
+  int    ret;
 
   unsigned long bytecount;
@@ -396,5 +397,11 @@
 
 
-      write (newf, buf, dat);
+      ret = write (newf, buf, dat);
+      if (dat > 0 && ret < 0)
+	{
+	  fprintf(stdout, _("ERROR Cannot write to output file %s.\n"), newn);
+	  fflush(stdout);
+	  return EXIT_FAILURE;
+	}
     }
 
@@ -418,5 +425,11 @@
 
   dat = read (oldf, buf, (GRAB_SIZE / 2));
-  write (newf, buf, dat);
+  ret = write (newf, buf, dat);
+  if (dat > 0 && ret < 0)
+    {
+      fprintf(stdout, _("ERROR Cannot write to output file %s.\n"), newn);
+      fflush(stdout);
+      return EXIT_FAILURE;
+    }
 
   bytecount = 0;
@@ -469,5 +482,11 @@
 	}
 
-      write (newf, buf, dat);
+      ret = write (newf, buf, dat);
+      if (dat > 0 && ret < 0)
+	{
+	  fprintf(stdout, _("ERROR Cannot write to output file %s.\n"), newn);
+	  fflush(stdout);
+	  return EXIT_FAILURE;
+	}
     }
 
Index: trunk/src/sh_calls.c
===================================================================
--- trunk/src/sh_calls.c	(revision 169)
+++ trunk/src/sh_calls.c	(revision 170)
@@ -59,5 +59,5 @@
 typedef struct cht_struct 
 {
-  char           * str;
+  const char           * str;
   unsigned long    val;
 } cht_type;
@@ -109,5 +109,5 @@
 /* Need to catch EINTR for these functions.
  */
-long int retry_sigaction(char * file, int line,
+long int retry_sigaction(const char * file, int line,
 			 int signum,  const  struct  sigaction  *act,
 			 struct sigaction *oldact)
@@ -156,5 +156,5 @@
 
 
-long int retry_connect(char * file, int line, int sockfd, 
+long int retry_connect(const char * file, int line, int sockfd, 
 		       struct sockaddr *serv_addr, int addrlen)
 {
@@ -209,5 +209,5 @@
 }
 
-long int retry_accept(char * file, int line, int fd, 
+long int retry_accept(const char * file, int line, int fd, 
 		      struct sockaddr *serv_addr, int * addrlen)
 {
@@ -236,5 +236,5 @@
 }
 
-long int retry_lstat(char * file, int line, 
+long int retry_lstat(const char * file, int line, 
 		     const char *file_name, struct stat *buf)
 {
@@ -259,5 +259,5 @@
 }
 
-long int retry_stat(char * file, int line, 
+long int retry_stat(const char * file, int line, 
 		    const char *file_name, struct stat *buf)
 {
@@ -282,5 +282,5 @@
 }
 
-long int retry_fstat(char * file, int line, int filed, struct stat *buf)
+long int retry_fstat(const char * file, int line, int filed, struct stat *buf)
 {
   int error;
@@ -303,5 +303,5 @@
 }
 
-long int retry_fcntl(char * file, int line, int fd, int cmd, long arg)
+long int retry_fcntl(const char * file, int line, int fd, int cmd, long arg)
 {
   int error;
@@ -389,5 +389,5 @@
  ***************************************************/
 
-long int retry_aud_execve  (char * file, int line, 
+long int retry_aud_execve  (const char * file, int line, 
 			    const  char *dateiname, char * argv[],
 			    char * envp[])
@@ -419,6 +419,6 @@
 
 
-long int retry_aud_utime (char * file, int line, 
-			   char * path, struct utimbuf *buf)
+long int retry_aud_utime (const char * file, int line, 
+			  char * path, struct utimbuf *buf)
 {
   long int val_return;
@@ -450,5 +450,5 @@
 }
 
-long int retry_aud_unlink (char * file, int line, 
+long int retry_aud_unlink (const char * file, int line, 
 			   char * path)
 {
@@ -477,5 +477,5 @@
 }
 
-long int retry_aud_dup2 (char * file, int line, 
+long int retry_aud_dup2 (const char * file, int line, 
 			 int fd, int fd2)
 {
@@ -504,5 +504,5 @@
 }
 
-long int retry_aud_dup (char * file, int line, 
+long int retry_aud_dup (const char * file, int line, 
 			int fd)
 {
@@ -532,5 +532,5 @@
 
   
-long int retry_aud_chdir (char * file, int line, 
+long int retry_aud_chdir (const char * file, int line, 
 			  const char *path)
 {
@@ -560,5 +560,5 @@
 
 
-long int aud_open_noatime (char * file, int line, int privs,
+long int aud_open_noatime (const char * file, int line, int privs,
 			   const char *pathname, int flags, mode_t mode,
 			   int * o_noatime)
@@ -601,5 +601,5 @@
 }
 
-long int aud_open (char * file, int line, int privs,
+long int aud_open (const char * file, int line, int privs,
 		   const char *pathname, int flags, mode_t mode)
 {
@@ -635,5 +635,5 @@
 }
   
-long int aud_kill (char * file, int line, pid_t pid, int sig)
+long int aud_kill (const char * file, int line, pid_t pid, int sig)
 {
   int  myerror;
@@ -657,5 +657,5 @@
   
 /*@noreturn@*/
-void aud_exit (char * file, int line, int fd)
+void aud_exit (const char * file, int line, int fd)
 {
   if (sh.flag.audit != 0 && (sh.flag.aud_mask & AUD_EXIT) != 0)
@@ -670,5 +670,5 @@
 
 /*@noreturn@*/
-void aud__exit (char * file, int line, int fd)
+void aud__exit (const char * file, int line, int fd)
 {
   if (sh.flag.audit != 0 && (sh.flag.aud_mask & AUD_EXIT) != 0)
@@ -682,5 +682,5 @@
 }
 
-pid_t aud_fork (char * file, int line)
+pid_t aud_fork (const char * file, int line)
 {
   int error;
@@ -703,5 +703,5 @@
 }
 
-int aud_setuid (char * file, int line, uid_t uid)
+int aud_setuid (const char * file, int line, uid_t uid)
 {
   int error = 0;
@@ -731,5 +731,5 @@
 }
 
-int aud_setgid (char * file, int line, gid_t gid)
+int aud_setgid (const char * file, int line, gid_t gid)
 {
   int error = 0;
@@ -760,5 +760,5 @@
 }
 
-int aud_pipe (char * file, int line, int * modus)
+int aud_pipe (const char * file, int line, int * modus)
 {
   int error;
Index: trunk/src/sh_cat.c
===================================================================
--- trunk/src/sh_cat.c	(revision 169)
+++ trunk/src/sh_cat.c	(revision 170)
@@ -8,5 +8,5 @@
 /*@-nullassign@*/
 
-char * class_cat[] = {
+const char * class_cat[] = {
   N_("AUD"),     /*  0 */
   N_("PANIC"),   /*  1 */
@@ -263,5 +263,5 @@
   { MSG_E_READ,      SH_ERR_ERR,     ERR,   N_("msg=\"Not accessible or not a regular file\" path=\"%s\"")},
   { MSG_E_TIMEOUT,   SH_ERR_ERR,     ERR,   N_("msg=\"Timeout (%d sec) while checksumming file\" path=\"%s\"")},
-  { MSG_NODEV,       SH_ERR_ERR,     ERR,   N_("msg=\"Device not available\" userid=\"%ld\" path=\"%s\"")},
+  { MSG_NODEV,       SH_ERR_ERR,     ERR,   N_("msg=\"Device not available or timeout during read attempt\" userid=\"%ld\" path=\"%s\"")},
   { MSG_LOCKED,      SH_ERR_ERR,     ERR,   N_("msg=\"File lock error\" userid=\"%ld\" path=\"%s\" obj=\"%s\"")},
   { MSG_PIDFILE,      SH_ERR_ERR,     ERR,   N_("msg=\"Could not write PID file\" userid=\"%ld\" path=\"%s\"")},
@@ -580,5 +580,5 @@
   { MSG_E_READ,      SH_ERR_ERR,     ERR,   N_("msg=<Not accessible or not a regular file>, path=<%s>")},
   { MSG_E_TIMEOUT,   SH_ERR_ERR,     ERR,   N_("msg=<Timeout (%d sec) while checksumming file>, path=<%s>")},
-  { MSG_NODEV,       SH_ERR_ERR,     ERR,   N_("msg=<Device not available>, userid=<%ld>, path=<%s>")},
+  { MSG_NODEV,       SH_ERR_ERR,     ERR,   N_("msg=<Device not available or timeout during read attempt>, userid=<%ld>, path=<%s>")},
   { MSG_LOCKED,      SH_ERR_ERR,     ERR,   N_("msg=<File lock error>, userid=<%ld>, path=<%s>, obj=<%s>")},
   { MSG_PIDFILE,      SH_ERR_ERR,     ERR,   N_("msg=<Could not write PID file>, userid=<%ld>, path=<%s>")},
Index: trunk/src/sh_database.c
===================================================================
--- trunk/src/sh_database.c	(revision 169)
+++ trunk/src/sh_database.c	(revision 170)
@@ -61,5 +61,5 @@
   char            msg[1024];
   char            sev[8];
-  char            path[12288];
+  char            path[MAX_PATH_STORE+1];
   char            user[9];
   char            group[9];
@@ -82,6 +82,6 @@
   char            interface[64];   
   char            ltime[64];   
-  char            dir[1024];   
-  char            linked_path[1024]; 
+  char            dir[MAX_PATH_STORE+1];   
+  char            linked_path[MAX_PATH_STORE+1]; 
   char            service[64];   
   char            facility[32];   
@@ -107,6 +107,6 @@
   char            chksum_old[50];
   char            chksum_new[50];
-  char            link_old[1024];
-  char            link_new[1024];
+  char            link_old[MAX_PATH_STORE+1];
+  char            link_new[MAX_PATH_STORE+1];
   char            acl_old[1024];
   char            acl_new[1024];
@@ -134,5 +134,5 @@
   { NULL, N_("msg"),         0,   4, 1024, 0, offsetof(struct dbins_, msg) },
 
-  { NULL, N_("path"),        0,   5,12288, 0, offsetof(struct dbins_, path)  },
+  { NULL, N_("path"),        0,   5,MAX_PATH_STORE+1, 0, offsetof(struct dbins_, path)  },
   /* username -> userid; replace (long) 'userid' - below - by 'dummy' */ 
   { NULL, N_("userid"),      0,   6,    9, 0, offsetof(struct dbins_, user)  },
@@ -155,6 +155,6 @@
   { NULL, N_("interface"),   0,  24,   64, 0, offsetof(struct dbins_, interface)},
   { NULL, N_("time"),        0,  25,   64, 0, offsetof(struct dbins_, ltime)  },
-  { NULL, N_("dir"),         0,  26, 1024, 0, offsetof(struct dbins_, dir)  },
-  { NULL, N_("linked_path"), 0,  27, 1024, 0, offsetof(struct dbins_, linked_path)},
+  { NULL, N_("dir"),         0,  26, MAX_PATH_STORE+1, 0, offsetof(struct dbins_, dir)  },
+  { NULL, N_("linked_path"), 0,  27, MAX_PATH_STORE+1, 0, offsetof(struct dbins_, linked_path)},
   { NULL, N_("service"),     0,  29,   64, 0, offsetof(struct dbins_, service)},
   { NULL, N_("facility"),    0,  30,   32, 0, offsetof(struct dbins_, facility) },
@@ -178,6 +178,6 @@
   { NULL, N_("chksum_old"),  0,  47,   50, 0, offsetof(struct dbins_, chksum_old)},
   { NULL, N_("chksum_new"),  0,  48,   50, 0, offsetof(struct dbins_, chksum_new)},
-  { NULL, N_("link_old"),    0,  49, 1024, 0, offsetof(struct dbins_, link_old)},
-  { NULL, N_("link_new"),    0,  50, 1024, 0, offsetof(struct dbins_, link_new)},
+  { NULL, N_("link_old"),    0,  49, MAX_PATH_STORE+1, 0, offsetof(struct dbins_, link_old)},
+  { NULL, N_("link_new"),    0,  50, MAX_PATH_STORE+1, 0, offsetof(struct dbins_, link_new)},
                				    
   { NULL, N_("size_old"),     0,  51,    0, 0, 0  },
@@ -1034,5 +1034,5 @@
 static int        connection_status = S_FALSE;
 
-void sh_database_reset()
+void sh_database_reset(void)
 {
   connection_status = S_FALSE;
@@ -1226,5 +1226,6 @@
 }
 
-#define SH_QUERY_MAX 16383
+#define SH_QUERY_MAX SH_MSG_BUF
+/* define SH_QUERY_MAX 16383 */
 
 static
@@ -1450,11 +1451,11 @@
 static int sh_database_comp_attr (const void *m1, const void *m2) 
 {
-  my_attr *mi1 = (my_attr *) m1;
-  my_attr *mi2 = (my_attr *) m2;
+  const my_attr *mi1 = (const my_attr *) m1;
+  const my_attr *mi2 = (const my_attr *) m2;
   return strcmp(mi1->attr, mi2->attr);
 }
 
 
-static void init_attr_table()
+static void init_attr_table(void)
 {
   static  int first = S_TRUE;
Index: trunk/src/sh_entropy.c
===================================================================
--- trunk/src/sh_entropy.c	(revision 169)
+++ trunk/src/sh_entropy.c	(revision 170)
@@ -281,5 +281,5 @@
 #include "sh_pthread.h"
 
-int read_mbytes(int timeout_val, char * path, char * nbuf, int nbytes)
+int read_mbytes(int timeout_val, const char * path, char * nbuf, int nbytes)
 {
   int m_count;
Index: trunk/src/sh_err_console.c
===================================================================
--- trunk/src/sh_err_console.c	(revision 169)
+++ trunk/src/sh_err_console.c	(revision 170)
@@ -127,5 +127,5 @@
 #define MY_MAX_MSG    1022
 
-static int push_message_queue (char * msg)
+static int push_message_queue (const char * msg)
 {
   struct sh_msgbuf*   recv_msg = NULL;
@@ -258,5 +258,5 @@
 
 #if defined(WITH_TRACE) || defined(WITH_TPT)
-char *  sh_log_console_name ()
+char *  sh_log_console_name (void)
 {
   if (! sh.srvcons.name || sh.srvcons.name[0] == '\0' ||
@@ -273,5 +273,5 @@
 /* ---- Print out a message. ----
  */
-int  sh_log_console (/*@null@*/char *errmsg)
+int  sh_log_console (const /*@null@*/char *errmsg)
 {
   static int service_failure[2] = { 0, 0};
Index: trunk/src/sh_err_log.c
===================================================================
--- trunk/src/sh_err_log.c	(revision 169)
+++ trunk/src/sh_err_log.c	(revision 170)
@@ -184,6 +184,6 @@
 #endif
 
-  buf  = (char *) SH_ALLOC( 2*SH_BUFSIZE+1 );
-  bufc = (char *) SH_ALLOC( 2*SH_BUFSIZE+1 );
+  buf  = (char *) SH_ALLOC( 2*SH_MSG_BUF+1 );
+  bufc = (char *) SH_ALLOC( 2*SH_MSG_BUF+1 );
 
   while (1 == 1) 
@@ -191,5 +191,5 @@
       /* get the log message
        */
-      if (sh_unix_getline (fd, buf, (2*SH_BUFSIZE)) < 0) 
+      if (sh_unix_getline (fd, buf, (2*SH_MSG_BUF)) < 0) 
 	break;
 
@@ -222,5 +222,5 @@
 	  start = 1;
 	  do {
-	    if ( sh_unix_getline (fd, buf, (2*SH_BUFSIZE)) < 0)
+	    if ( sh_unix_getline (fd, buf, (2*SH_MSG_BUF)) < 0)
 	      break;
 	  } while (buf[0] == '\0' || buf[0] == '\n');
@@ -293,5 +293,5 @@
 	{
 	  do {
-	    if ( sh_unix_getline (fd, bufc, (2*SH_BUFSIZE)) < 0)
+	    if ( sh_unix_getline (fd, bufc, (2*SH_MSG_BUF)) < 0)
 	      break;
 	  } while (bufc[0] == '\0' || bufc[0] == '\n');
@@ -301,7 +301,7 @@
 	      /* A continuation line. Add the newline. 
 	       */
-	      (void) sl_strlcat(buf, "\n", 2*SH_BUFSIZE+1);
+	      (void) sl_strlcat(buf, "\n", 2*SH_MSG_BUF+1);
 	      ++len;
-	      (void) sl_strlcat(buf, bufc, 2*SH_BUFSIZE+1);
+	      (void) sl_strlcat(buf, bufc, 2*SH_MSG_BUF+1);
 	      len += (int) sl_strlen(bufc);
 	    }
@@ -437,5 +437,5 @@
 	}
       
-      (void) sl_strlcat ( buf, key, 2*SH_BUFSIZE + 1);
+      (void) sl_strlcat ( buf, key, 2*SH_MSG_BUF + 1);
       
 #ifdef SH_STEALTH
Index: trunk/src/sh_err_syslog.c
===================================================================
--- trunk/src/sh_err_syslog.c	(revision 169)
+++ trunk/src/sh_err_syslog.c	(revision 170)
@@ -31,5 +31,5 @@
 
 typedef struct log_fac_struct {
-  char * name;
+  const char * name;
   int    facility;
 } logfct;
Index: trunk/src/sh_error.c
===================================================================
--- trunk/src/sh_error.c	(revision 169)
+++ trunk/src/sh_error.c	(revision 170)
@@ -105,5 +105,5 @@
 static int sh_error_string (struct _log_t * lmsg, va_list vl);
 
-extern int  sh_log_console (/*@null@*/char *message);
+extern int  sh_log_console (/*@null@*/const char *message);
 extern int  sh_log_syslog  (int  severity, /*@null@*/char *message);
 extern int  sh_log_file    (/*@null@*/char *message, 
@@ -173,5 +173,5 @@
 
 static
-void compute_flag_err_debug()
+void compute_flag_err_debug(void)
 {
   if ((errFlags.loglevel & SH_ERR_ALL) != 0)
@@ -197,5 +197,5 @@
 
 static
-void compute_flag_err_info()
+void compute_flag_err_info(void)
 {
   if ((errFlags.loglevel & SH_ERR_INFO) != 0)
@@ -220,5 +220,5 @@
 }
 
-void sh_error_dbg_switch()
+void sh_error_dbg_switch(void)
 {
   if (dbg_flag == 0)
@@ -466,5 +466,5 @@
 typedef struct eef 
 {
-  char * str;
+  const char * str;
   int    val;
 } eef_struc;
@@ -797,5 +797,5 @@
 /* init or re-init log facilities that need it
  */
-void sh_error_fixup()
+void sh_error_fixup(void)
 {
 #if defined(HAVE_LIBPRELUDE_9)
@@ -813,5 +813,5 @@
 /* to be called from sh_prelude_reset
  */
-void sh_error_init_prelude()
+void sh_error_init_prelude(void)
 {
 #if defined(HAVE_LIBPRELUDE_9)
@@ -865,5 +865,5 @@
 SH_MUTEX_RECURSIVE(mutex_err_handle);
 
-void sh_error_handle (int sev, char * file, long line, 
+void sh_error_handle (int sev, const char * file, long line, 
 		      long status, unsigned long msg_id, ...)
 {
@@ -875,5 +875,5 @@
   char * fmt;
 
-  int    flag_inet  = S_FALSE;
+  int    flag_inet;
 
 #ifdef SH_WITH_SERVER
@@ -974,4 +974,8 @@
     {
       flag_inet = S_TRUE;
+    }
+  else
+    {
+      flag_inet  = S_FALSE;
     }
 
@@ -1355,5 +1359,5 @@
 	  *priority = (int) msg_cat[i].priority;
 	  *class    = (unsigned int) msg_cat[i].class;
-	  SL_RETURN (_(msg_cat[i].format), _("get_format"));
+	  SL_RETURN (((char *) _(msg_cat[i].format)), _("get_format"));
 	}
       ++i;
@@ -1545,4 +1549,5 @@
       /*@i@*/required = sl_vsnprintf(&(lmsg->msg[len]), 
 				     (lmsg->msg_len - len), lmsg->format, vl);
+
       if ((required >= 0) && 
 	  sl_ok_adds(required, len) &&
@@ -1556,5 +1561,5 @@
 	  lmsg->msg_len = required + len + 4;
 	  (void) sl_vsnprintf(&(lmsg->msg[len]), 
-			      (required + len + 1), lmsg->format, vl2);
+			      (required + 1), lmsg->format, vl2);
 	}
       va_end(vl2);
Index: trunk/src/sh_extern.c
===================================================================
--- trunk/src/sh_extern.c	(revision 169)
+++ trunk/src/sh_extern.c	(revision 170)
@@ -825,5 +825,5 @@
   if (!ext_com)
     {
-      SL_RETURN( NULL, ("command_init"));
+      SL_RETURN( NULL, _("command_init"));
     }
 
@@ -853,5 +853,5 @@
   ext_com->next             = NULL;
 
-  SL_RETURN( ext_com, ("command_init"));
+  SL_RETURN( ext_com, _("command_init"));
 }
 
@@ -1170,14 +1170,14 @@
   if (ext_coms == NULL || ext_failed == (-1) || str == NULL)
     {
-      SL_RETURN (-1, ("sh_ext_deadtime"));
+      SL_RETURN (-1, _("sh_ext_deadtime"));
     }
   deadtime = strtol(str, &tail, 10);
   if (tail == str || deadtime < 0 || deadtime == LONG_MAX)
     {
-      SL_RETURN (-1, ("sh_ext_deadtime"));
+      SL_RETURN (-1, _("sh_ext_deadtime"));
     }
   
   ext_coms->deadtime = (time_t) deadtime;  
-  SL_RETURN (0, ("sh_ext_deadtime"));  
+  SL_RETURN (0, _("sh_ext_deadtime"));  
 }
 
Index: trunk/src/sh_files.c
===================================================================
--- trunk/src/sh_files.c	(revision 169)
+++ trunk/src/sh_files.c	(revision 170)
@@ -1482,6 +1482,6 @@
 			      char * relativeName)
 {
-  struct sh_dirent * dirlist = NULL;
-  struct sh_dirent * dirlist_orig = NULL;
+  struct sh_dirent * dirlist;
+  struct sh_dirent * dirlist_orig;
 
   DIR *           thisDir = NULL;
@@ -1646,4 +1646,7 @@
    */
   SH_MUTEX_LOCK(mutex_readdir);
+
+  dirlist = NULL;
+  dirlist_orig = NULL;
 
   do {
@@ -2273,5 +2276,5 @@
 }
 
-extern void     aud_exit   (char * file, int line, int fd);
+extern void     aud_exit   (const char * file, int line, int fd);
       
 int sh_files_test_setup ()
Index: trunk/src/sh_forward.c
===================================================================
--- trunk/src/sh_forward.c	(revision 169)
+++ trunk/src/sh_forward.c	(revision 170)
@@ -2220,5 +2220,5 @@
 /* -- Mark all clients as dead.
  */
-void sh_forward_mark_dead ()
+void sh_forward_mark_dead (void)
 {
   zAVLCursor avlcursor;
@@ -2238,5 +2238,5 @@
 /* -- Clean tree from dead clients.
  */
-void sh_forward_clean_tree ()
+void sh_forward_clean_tree (void)
 {
   zAVLCursor avlcursor;
@@ -2499,5 +2499,5 @@
 /* -- Check for time limit exceeded. --
  */
-static int client_time_check()
+static int client_time_check(void)
 {
   zAVLCursor avlcursor;
@@ -4814,5 +4814,5 @@
 static int sh_tcp_sock = -1;
 
-int sh_create_tcp_socket ()
+int sh_create_tcp_socket (void)
 {
   struct sockaddr_in addr;
@@ -5382,5 +5382,5 @@
 }
 
-void  free_client_tree ()
+void  free_client_tree (void)
 {
   SL_ENTER(_("free_client_tree"));
Index: trunk/src/sh_getopt.c
===================================================================
--- trunk/src/sh_getopt.c	(revision 169)
+++ trunk/src/sh_getopt.c	(revision 170)
@@ -52,7 +52,7 @@
 
 typedef struct options {
-  char * longopt;
+  const char * longopt;
   const char   shortopt;
-  char * usage;
+  const char * usage;
   int          hasArg;
   int (*func)(const char * opt);
@@ -313,5 +313,5 @@
 
 
-static void sh_getopt_print_log_facilities ()
+static void sh_getopt_print_log_facilities (void)
 {
   fputs (_("Compiled-in log facilities:"), stdout);
@@ -372,5 +372,5 @@
 }
 
-static void sh_getopt_print_options ()
+static void sh_getopt_print_options (void)
 {
   int num = 0;
@@ -484,5 +484,5 @@
 }
 
-static void sh_getopt_print_modules ()
+static void sh_getopt_print_modules (void)
 {
 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 
@@ -686,5 +686,5 @@
 static int sh_getopt_forever (const char * dummy)
 {
-  dummy = (void *) dummy;
+  (void) dummy;
   SL_ENTER(_("sh_getopt_forever"));
   sh.flag.loop = S_TRUE;
Index: trunk/src/sh_gpg.c
===================================================================
--- trunk/src/sh_gpg.c	(revision 169)
+++ trunk/src/sh_gpg.c	(revision 170)
@@ -214,5 +214,5 @@
 static struct startup_info startInfo = { 0, NULL, 0, NULL, NULL, NULL };
 
-void sh_gpg_log_startup ()
+void sh_gpg_log_startup (void)
 {
   if (startInfo.program != NULL)
Index: trunk/src/sh_hash.c
===================================================================
--- trunk/src/sh_hash.c	(revision 169)
+++ trunk/src/sh_hash.c	(revision 170)
@@ -246,8 +246,4 @@
 
 
-/* MAX_PATH_STORE must be >= KEY_LEN
- */
-#define MAX_PATH_STORE 12287
-
 typedef struct store_info {
 
@@ -294,5 +290,5 @@
 } sh_file_t;
 
-  static char  *policy[] = {
+  static const char  *policy[] = {
     N_("[]"),
     N_("[ReadOnly]"),
@@ -426,9 +422,11 @@
   char * str;
   char hashbuf[KEYBUF_SIZE];
-  int  retval = 0;
+  int  retval;
 
   /* --------  find the entry for the file ----------------       */
 
   SH_MUTEX_LOCK(mutex_hash);
+
+  retval = 0;
 
   if (sl_strlen(fullpath) <= MAX_PATH_STORE) 
@@ -786,5 +784,5 @@
 }
 
-static void sh_hash_getline_end ()
+static void sh_hash_getline_end (void)
 {
   fclose (sh_fin_fd);
@@ -1123,5 +1121,5 @@
 
   sh_file_t * p;
-  SL_TICKET fd    = (-1);
+  SL_TICKET fd;
   long i;
   int count = 0;
@@ -1134,6 +1132,6 @@
   char * buf  = NULL;
   int    bufc;
-  int    flag_pgp = S_FALSE;
-  int    flag_nohead = S_FALSE;
+  int    flag_pgp;
+  int    flag_nohead;
   SL_TICKET fdTmp = (-1);
   SL_TICKET open_tmp (void);
@@ -1144,4 +1142,9 @@
 
   SH_MUTEX_LOCK(mutex_hash);
+
+#if defined(WITH_GPG) || defined(WITH_PGP)
+  flag_pgp = S_FALSE;
+  flag_nohead = S_FALSE;
+#endif
 
   if (IsInit == 1)
@@ -1149,4 +1152,6 @@
       goto unlock_and_return;
     }
+
+  fd = (-1);
 
 #if defined(SH_WITH_CLIENT)
@@ -1308,9 +1313,9 @@
   /* } new 1.4.8 check sig also for files downloaded from server */
 
-  line = SH_ALLOC(MAX_PATH_STORE+1);
+  line = SH_ALLOC(MAX_PATH_STORE+2);
 
   /* fast forward to start of data
    */
-  sh_hash_setdataent(fd, line, MAX_PATH_STORE, file_path('D', 'R'));
+  sh_hash_setdataent(fd, line, MAX_PATH_STORE+1, file_path('D', 'R'));
 
   for (i = 0; i < TABSIZE; ++i) 
@@ -1326,5 +1331,5 @@
 	}
 
-      p = sh_hash_getdataent (fd, line, MAX_PATH_STORE);
+      p = sh_hash_getdataent (fd, line, MAX_PATH_STORE+1);
       if (p != NULL)
 	{
@@ -1922,5 +1927,5 @@
 {
   sh_file_t * p;
-  int retval = 0;
+  int retval;
 
   if (IsInit != 1) 
@@ -1928,4 +1933,7 @@
 
   SH_MUTEX_LOCK(mutex_hash);
+
+  retval = 0;
+
   p = sh_hash_have_it_int (newname);
 
@@ -1944,5 +1952,5 @@
 {
   sh_file_t * p;
-  int retval = -1;
+  int retval;
 
   if (IsInit != 1) 
@@ -1953,4 +1961,7 @@
 
   SH_MUTEX_LOCK(mutex_hash);
+
+  retval = (-1);
+
   p = sh_hash_have_it_int (newname);
   if (p)
@@ -1973,5 +1984,5 @@
 {
   sh_file_t * p;
-  int retval = -1;
+  int retval;
 
   if (IsInit != 1) 
@@ -1982,4 +1993,6 @@
   if (p)
     retval = p->fflags;
+  else
+    retval = -1;
   SH_MUTEX_UNLOCK(mutex_hash);
   return retval;
@@ -1989,5 +2002,5 @@
 {
   sh_file_t * p;
-  int retval = -1;
+  int retval;
 
   if (IsInit != 1) 
@@ -2001,4 +2014,6 @@
       retval = 0;
     }
+  else
+    retval = -1;
   SH_MUTEX_UNLOCK(mutex_hash);
   return retval;
@@ -2035,5 +2050,5 @@
   sh_file_t * p;
   char hashbuf[KEYBUF_SIZE];
-  int  retval = -1;
+  int  retval;
 
   SL_ENTER(_("sh_hash_set_visited_int"));
@@ -2072,4 +2087,6 @@
       retval = 0;
     }
+  else
+    retval = -1;
 
   SH_MUTEX_UNLOCK(mutex_hash);
@@ -2373,6 +2390,6 @@
   char * format;
 
-  char * tmp = SH_ALLOC(SH_BUFSIZE);
-  char * msg = SH_ALLOC(SH_BUFSIZE);
+  char * tmp = SH_ALLOC(SH_MSG_BUF);
+  char * msg = SH_ALLOC(SH_MSG_BUF);
 
   tmp[0] = '\0';
@@ -2385,5 +2402,5 @@
   else 
     format = _("mode_old=\"%s\" attr_old=\"%s\" imode_old=\"%ld\" iattr_old=\"%ld\" ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      theFile->c_mode,
 	      theFile->c_attributes,
@@ -2397,10 +2414,10 @@
     format = _("mode_old=\"%s\" imode_old=\"%ld\" ");
 
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      theFile->c_mode,
 	      (long) theFile->mode
 	      );
 #endif
-  sl_strlcat(msg, tmp, SH_BUFSIZE);
+  sl_strlcat(msg, tmp, SH_MSG_BUF);
 
   if (is_new)
@@ -2408,7 +2425,7 @@
   else
     format = _("hardlinks_old=\"%lu\" ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      (unsigned long) theFile->hardlinks);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
@@ -2417,6 +2434,6 @@
   else
     format = _("idevice_old=\"%lu\" ");
-  sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->rdev);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_snprintf(tmp, SH_MSG_BUF, format, (unsigned long) theFile->rdev);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
@@ -2425,6 +2442,6 @@
   else
     format = _("inode_old=\"%lu\" ");
-  sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->ino);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_snprintf(tmp, SH_MSG_BUF, format, (unsigned long) theFile->ino);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
   /* 
@@ -2436,8 +2453,8 @@
   else
     format = _("dev_old=\"%lu,%lu\" ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,		      
+  sl_snprintf(tmp, SH_MSG_BUF, format,		      
 	      (unsigned long) major(theFile->dev),
 	      (unsigned long) minor(theFile->dev));
-  sl_strlcat(msg, tmp, SH_BUFSIZE);
+  sl_strlcat(msg, tmp, SH_MSG_BUF);
 #endif
 
@@ -2447,7 +2464,7 @@
   else
     format = _("owner_old=\"%s\" iowner_old=\"%ld\" ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      theFile->c_owner, (long) theFile->owner);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
@@ -2456,44 +2473,44 @@
   else
     format = _("group_old=\"%s\" igroup_old=\"%ld\" ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      theFile->c_group, (long) theFile->group);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, sh_hash_size_format(),
+    sl_snprintf(tmp, SH_MSG_BUF, sh_hash_size_format(),
 		(UINT64) 0, (UINT64) theFile->size);
   else
-    sl_snprintf(tmp, SH_BUFSIZE, sh_hash_size_format(),
+    sl_snprintf(tmp, SH_MSG_BUF, sh_hash_size_format(),
 		(UINT64) theFile->size, (UINT64) 0);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
   (void) sh_unix_gmttime (theFile->ctime, timstr1c,  sizeof(timstr1c));
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, _("ctime_new=\"%s\" "), timstr1c);
-  else
-    sl_snprintf(tmp, SH_BUFSIZE, _("ctime_old=\"%s\" "), timstr1c);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+    sl_snprintf(tmp, SH_MSG_BUF, _("ctime_new=\"%s\" "), timstr1c);
+  else
+    sl_snprintf(tmp, SH_MSG_BUF, _("ctime_old=\"%s\" "), timstr1c);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
   (void) sh_unix_gmttime (theFile->atime, timstr1a,  sizeof(timstr1a));
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, _("atime_new=\"%s\" "), timstr1a);
-  else
-    sl_snprintf(tmp, SH_BUFSIZE, _("atime_old=\"%s\" "), timstr1a);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+    sl_snprintf(tmp, SH_MSG_BUF, _("atime_new=\"%s\" "), timstr1a);
+  else
+    sl_snprintf(tmp, SH_MSG_BUF, _("atime_old=\"%s\" "), timstr1a);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
   (void) sh_unix_gmttime (theFile->mtime, timstr1m,  sizeof(timstr1m));
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, _("mtime_new=\"%s\" "), timstr1m);
-  else
-    sl_snprintf(tmp, SH_BUFSIZE, _("mtime_old=\"%s\" "), timstr1m);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+    sl_snprintf(tmp, SH_MSG_BUF, _("mtime_new=\"%s\" "), timstr1m);
+  else
+    sl_snprintf(tmp, SH_MSG_BUF, _("mtime_old=\"%s\" "), timstr1m);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, _("chksum_new=\"%s\" "), fileHash);
-  else
-    sl_snprintf(tmp, SH_BUFSIZE, _("chksum_old=\"%s\" "), fileHash);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+    sl_snprintf(tmp, SH_MSG_BUF, _("chksum_new=\"%s\" "), fileHash);
+  else
+    sl_snprintf(tmp, SH_MSG_BUF, _("chksum_old=\"%s\" "), fileHash);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
   if (theFile->c_mode[0] == 'l' || 
@@ -2504,9 +2521,9 @@
 	{
 	  if (is_new)
-	    sl_snprintf(tmp, SH_BUFSIZE, _("link_new=\"%s\" "), tmp_lnk);
+	    sl_snprintf(tmp, SH_MSG_BUF, _("link_new=\"%s\" "), tmp_lnk);
 	  else
-	    sl_snprintf(tmp, SH_BUFSIZE, _("link_old=\"%s\" "), tmp_lnk);
+	    sl_snprintf(tmp, SH_MSG_BUF, _("link_old=\"%s\" "), tmp_lnk);
 	  SH_FREE(tmp_lnk);
-	  sl_strlcat(msg, tmp, SH_BUFSIZE);
+	  sl_strlcat(msg, tmp, SH_MSG_BUF);
 	} 
     }
@@ -2518,9 +2535,9 @@
 	{
 	  if (is_new)
-	    sl_snprintf(tmp, SH_BUFSIZE, _("acl_new=\"%s\" "), tmp_lnk);
+	    sl_snprintf(tmp, SH_MSG_BUF, _("acl_new=\"%s\" "), tmp_lnk);
 	  else
-	    sl_snprintf(tmp, SH_BUFSIZE, _("acl_old=\"%s\" "), tmp_lnk);
+	    sl_snprintf(tmp, SH_MSG_BUF, _("acl_old=\"%s\" "), tmp_lnk);
 	  SH_FREE(tmp_lnk);
-	  sl_strlcat(msg, tmp, SH_BUFSIZE);
+	  sl_strlcat(msg, tmp, SH_MSG_BUF);
 	} 
     }
@@ -2540,6 +2557,6 @@
   char * format;
 
-  char * tmp = SH_ALLOC(SH_BUFSIZE);
-  char * msg = SH_ALLOC(SH_BUFSIZE);
+  char * tmp = SH_ALLOC(SH_MSG_BUF);
+  char * msg = SH_ALLOC(SH_MSG_BUF);
 
   tmp[0] = '\0';
@@ -2552,5 +2569,5 @@
   else 
     format = _("mode_old=<%s>, attr_old=<%s>, imode_old=<%ld>, iattr_old=<%ld>, ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      theFile->c_mode,
 	      theFile->c_attributes,
@@ -2564,10 +2581,10 @@
     format = _("mode_old=<%s>, imode_old=<%ld>, ");
 
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      theFile->c_mode,
 	      (long) theFile->mode
 	      );
 #endif
-  sl_strlcat(msg, tmp, SH_BUFSIZE);
+  sl_strlcat(msg, tmp, SH_MSG_BUF);
 
   if (is_new)
@@ -2575,7 +2592,7 @@
   else
     format = _("hardlinks_old=<%lu>, ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      (unsigned long) theFile->hardlinks);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
@@ -2584,6 +2601,6 @@
   else
     format = _("idevice_old=<%lu>, ");
-  sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->rdev);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_snprintf(tmp, SH_MSG_BUF, format, (unsigned long) theFile->rdev);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
@@ -2592,6 +2609,6 @@
   else
     format = _("inode_old=<%lu>, ");
-  sl_snprintf(tmp, SH_BUFSIZE, format, (unsigned long) theFile->ino);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_snprintf(tmp, SH_MSG_BUF, format, (unsigned long) theFile->ino);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
@@ -2604,8 +2621,8 @@
   else
     format = _("dev_old=<%lu,%lu>, ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,		      
+  sl_snprintf(tmp, SH_MSG_BUF, format,		      
 	      (unsigned long) major(theFile->dev),
 	      (unsigned long) minor(theFile->dev));
-  sl_strlcat(msg, tmp, SH_BUFSIZE);
+  sl_strlcat(msg, tmp, SH_MSG_BUF);
 #endif
 
@@ -2614,7 +2631,7 @@
   else
     format = _("owner_old=<%s>, iowner_old=<%ld>, ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      theFile->c_owner, (long) theFile->owner);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
@@ -2623,44 +2640,44 @@
   else
     format = _("group_old=<%s>, igroup_old=<%ld>, ");
-  sl_snprintf(tmp, SH_BUFSIZE, format,
+  sl_snprintf(tmp, SH_MSG_BUF, format,
 	      theFile->c_group, (long) theFile->group);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, sh_hash_size_format(),
+    sl_snprintf(tmp, SH_MSG_BUF, sh_hash_size_format(),
 		(UINT64) 0, (UINT64) theFile->size);
   else
-    sl_snprintf(tmp, SH_BUFSIZE, sh_hash_size_format(),
+    sl_snprintf(tmp, SH_MSG_BUF, sh_hash_size_format(),
 		(UINT64) theFile->size, (UINT64) 0);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
 
   (void) sh_unix_gmttime (theFile->ctime, timstr1c,  sizeof(timstr1c));
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, _("ctime_new=<%s>, "), timstr1c);
-  else
-    sl_snprintf(tmp, SH_BUFSIZE, _("ctime_old=<%s>, "), timstr1c);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+    sl_snprintf(tmp, SH_MSG_BUF, _("ctime_new=<%s>, "), timstr1c);
+  else
+    sl_snprintf(tmp, SH_MSG_BUF, _("ctime_old=<%s>, "), timstr1c);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
   (void) sh_unix_gmttime (theFile->atime, timstr1a,  sizeof(timstr1a));
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, _("atime_new=<%s>, "), timstr1a);
-  else
-    sl_snprintf(tmp, SH_BUFSIZE, _("atime_old=<%s>, "), timstr1a);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+    sl_snprintf(tmp, SH_MSG_BUF, _("atime_new=<%s>, "), timstr1a);
+  else
+    sl_snprintf(tmp, SH_MSG_BUF, _("atime_old=<%s>, "), timstr1a);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
   (void) sh_unix_gmttime (theFile->mtime, timstr1m,  sizeof(timstr1m));
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, _("mtime_new=<%s>, "), timstr1m);
-  else
-    sl_snprintf(tmp, SH_BUFSIZE, _("mtime_old=<%s>, "), timstr1m);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+    sl_snprintf(tmp, SH_MSG_BUF, _("mtime_new=<%s>, "), timstr1m);
+  else
+    sl_snprintf(tmp, SH_MSG_BUF, _("mtime_old=<%s>, "), timstr1m);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
   if (is_new)
-    sl_snprintf(tmp, SH_BUFSIZE, _("chksum_new=<%s>"), fileHash);
-  else
-    sl_snprintf(tmp, SH_BUFSIZE, _("chksum_old=<%s>"), fileHash);
-  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+    sl_snprintf(tmp, SH_MSG_BUF, _("chksum_new=<%s>"), fileHash);
+  else
+    sl_snprintf(tmp, SH_MSG_BUF, _("chksum_old=<%s>"), fileHash);
+  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 
   if (theFile->c_mode[0] == 'l' || 
@@ -2671,9 +2688,9 @@
 	{
 	  if (is_new)
-	    sl_snprintf(tmp, SH_BUFSIZE, _(", link_new=<%s> "), tmp_lnk);
+	    sl_snprintf(tmp, SH_MSG_BUF, _(", link_new=<%s> "), tmp_lnk);
 	  else
-	    sl_snprintf(tmp, SH_BUFSIZE, _(", link_old=<%s> "), tmp_lnk);
+	    sl_snprintf(tmp, SH_MSG_BUF, _(", link_old=<%s> "), tmp_lnk);
 	  SH_FREE(tmp_lnk);
-	  sl_strlcat(msg, tmp, SH_BUFSIZE);
+	  sl_strlcat(msg, tmp, SH_MSG_BUF);
 	} 
     }
@@ -2685,9 +2702,9 @@
 	{
 	  if (is_new)
-	    sl_snprintf(tmp, SH_BUFSIZE, _(", acl_new=<%s> "), tmp_lnk);
+	    sl_snprintf(tmp, SH_MSG_BUF, _(", acl_new=<%s> "), tmp_lnk);
 	  else
-	    sl_snprintf(tmp, SH_BUFSIZE, _(", acl_old=<%s> "), tmp_lnk);
+	    sl_snprintf(tmp, SH_MSG_BUF, _(", acl_old=<%s> "), tmp_lnk);
 	  SH_FREE(tmp_lnk);
-	  sl_strlcat(msg, tmp, SH_BUFSIZE);
+	  sl_strlcat(msg, tmp, SH_MSG_BUF);
 	} 
     }
@@ -2747,5 +2764,5 @@
   int  i;
 
-  unsigned long modi_mask = 0;
+  unsigned long modi_mask;
 
   char log_policy[32];
@@ -2753,5 +2770,5 @@
   char hashbuf[KEYBUF_SIZE];
 
-  int  retval = 0;
+  int  retval;
 
   SL_ENTER(_("sh_hash_compdata"));
@@ -2770,4 +2787,7 @@
 
   SH_MUTEX_LOCK(mutex_hash);
+
+  modi_mask = 0;
+  retval    = 0;
 
   if (sl_strlen(theFile->fullpath) <= MAX_PATH_STORE) 
@@ -3044,6 +3064,6 @@
   if (modi_mask != 0 && (!SH_FFLAG_REPORTED_SET(p->fflags)))
     { 
-      tmp = SH_ALLOC(SH_BUFSIZE);
-      msg = SH_ALLOC(SH_BUFSIZE);
+      tmp = SH_ALLOC(SH_MSG_BUF);
+      msg = SH_ALLOC(SH_MSG_BUF);
       msg[0] = '\0';
 
@@ -3056,5 +3076,5 @@
 	{
 #if defined(__linux__) || defined(HAVE_STAT_FLAGS)
-	  sl_snprintf(tmp, SH_BUFSIZE, 
+	  sl_snprintf(tmp, SH_MSG_BUF, 
 #ifdef SH_USE_XML
 		      _("mode_old=\"%s\" mode_new=\"%s\" attr_old=\"%s\" attr_new=\"%s\" imode_old=\"%ld\" imode_new=\"%ld\" iattr_old=\"%ld\" iattr_new=\"%ld\" "),
@@ -3072,19 +3092,19 @@
 #else
 #ifdef SH_USE_XML
-	  sl_snprintf(tmp, SH_BUFSIZE, 
+	  sl_snprintf(tmp, SH_MSG_BUF, 
 		      _("mode_old=\"%s\" mode_new=\"%s\" imode_old=\"%ld\" imode_new=\"%ld\" "),
 		      p->theFile.c_mode, theFile->c_mode,
 		      (long) p->theFile.mode, (long) theFile->mode);
 #else
-	  sl_snprintf(tmp, SH_BUFSIZE, _("mode_old=<%s>, mode_new=<%s>, "),
+	  sl_snprintf(tmp, SH_MSG_BUF, _("mode_old=<%s>, mode_new=<%s>, "),
 		      p->theFile.c_mode, theFile->c_mode);
 #endif
 #endif
-	  sl_strlcat(msg, tmp, SH_BUFSIZE);
+	  sl_strlcat(msg, tmp, SH_MSG_BUF);
 
 #if defined(USE_ACL) || defined(USE_XATTR)
 	  if (theFile->attr_string != NULL || p->attr_string != NULL)
 	    {
-	      sl_snprintf(tmp, SH_BUFSIZE, 
+	      sl_snprintf(tmp, SH_MSG_BUF, 
 #ifdef SH_USE_XML
 			  _("acl_old=\"%s\" acl_new=\"%s\" "),
@@ -3095,5 +3115,5 @@
 			  (theFile->attr_string) ? theFile->attr_string : _("none"));
 	      
-	      sl_strlcat(msg, tmp, SH_BUFSIZE);
+	      sl_strlcat(msg, tmp, SH_MSG_BUF);
 	    }
 #endif
@@ -3135,5 +3155,5 @@
       if ((modi_mask & MODI_HLN) != 0)
 	{
-	  sl_snprintf(tmp, SH_BUFSIZE, 
+	  sl_snprintf(tmp, SH_MSG_BUF, 
 #ifdef SH_USE_XML
 		      _("hardlinks_old=\"%lu\" hardlinks_new=\"%lu\" "),
@@ -3143,5 +3163,5 @@
 		      (unsigned long) p->theFile.hardlinks, 
 		      (unsigned long) theFile->hardlinks);
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3152,5 +3172,5 @@
       if ((modi_mask & MODI_RDEV) != 0)
 	{
-	  sl_snprintf(tmp, SH_BUFSIZE,
+	  sl_snprintf(tmp, SH_MSG_BUF,
 #ifdef SH_USE_XML 
 		      _("device_old=\"%lu,%lu\" device_new=\"%lu,%lu\" idevice_old=\"%lu\" idevice_new=\"%lu\" "),
@@ -3167,5 +3187,5 @@
 #endif
 		      );
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3176,5 +3196,5 @@
       if ((modi_mask & MODI_INO) != 0)
 	{
-	  sl_snprintf(tmp, SH_BUFSIZE,
+	  sl_snprintf(tmp, SH_MSG_BUF,
 #ifdef SH_USE_XML 
 		      _("inode_old=\"%lu\" inode_new=\"%lu\" "),
@@ -3184,5 +3204,5 @@
 		      (unsigned long) p->theFile.ino, 
 		      (unsigned long) theFile->ino);
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3201,5 +3221,5 @@
       if ((modi_mask & MODI_INO) != 0)
 	{
-	  sl_snprintf(tmp, SH_BUFSIZE,
+	  sl_snprintf(tmp, SH_MSG_BUF,
 #ifdef SH_USE_XML 
 		      _("dev_old=\"%lu,%lu\" dev_new=\"%lu,%lu\" "),
@@ -3212,5 +3232,5 @@
 		      (unsigned long) minor(theFile->dev)
 		      );
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3227,8 +3247,8 @@
 	{
 #ifdef SH_USE_XML
-	  sl_snprintf(tmp, SH_BUFSIZE, 
+	  sl_snprintf(tmp, SH_MSG_BUF, 
 		      _("owner_old=\"%s\" owner_new=\"%s\" iowner_old=\"%ld\" iowner_new=\"%ld\" "),
 #else
-	  sl_snprintf(tmp, SH_BUFSIZE, 
+	  sl_snprintf(tmp, SH_MSG_BUF, 
 		      _("owner_old=<%s>, owner_new=<%s>, iowner_old=<%ld>, iowner_new=<%ld>, "),
 #endif
@@ -3236,5 +3256,5 @@
 		      (long) p->theFile.owner, (long) theFile->owner
 		      );
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if ((modi_mask & MODI_USR) != 0) {
@@ -3255,10 +3275,10 @@
 	{
 #ifdef SH_USE_XML
-	  sl_snprintf(tmp, SH_BUFSIZE, 
+	  sl_snprintf(tmp, SH_MSG_BUF, 
 		      _("group_old=\"%s\" group_new=\"%s\" igroup_old=\"%ld\" igroup_new=\"%ld\" "),
 		      p->theFile.c_group, theFile->c_group,
 		      (long) p->theFile.group, (long) theFile->group);
 #else
-	  sl_snprintf(tmp, SH_BUFSIZE, 
+	  sl_snprintf(tmp, SH_MSG_BUF, 
 		      _("group_old=<%s>, group_new=<%s>, igroup_old=<%ld>, igroup_new=<%ld>, "),
 		      p->theFile.c_group, theFile->c_group,
@@ -3266,5 +3286,5 @@
 #endif
 
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
           if ((modi_mask & MODI_GRP) != 0) {
@@ -3280,8 +3300,8 @@
       if ((modi_mask & MODI_SIZ) != 0)
 	{
-	  sl_snprintf(tmp, SH_BUFSIZE, sh_hash_size_format(),
+	  sl_snprintf(tmp, SH_MSG_BUF, sh_hash_size_format(),
 		      (UINT64) p->theFile.size, 
 		      (UINT64) theFile->size);
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3295,11 +3315,11 @@
 	  (void) sh_unix_gmttime (theFile->ctime,   timstr2c, sizeof(timstr2c));
 #ifdef SH_USE_XML
-	  sl_snprintf(tmp, SH_BUFSIZE, _("ctime_old=\"%s\" ctime_new=\"%s\" "),
+	  sl_snprintf(tmp, SH_MSG_BUF, _("ctime_old=\"%s\" ctime_new=\"%s\" "),
 		      timstr1c, timstr2c);
 #else
-	  sl_snprintf(tmp, SH_BUFSIZE, _("ctime_old=<%s>, ctime_new=<%s>, "),
+	  sl_snprintf(tmp, SH_MSG_BUF, _("ctime_old=<%s>, ctime_new=<%s>, "),
 		      timstr1c, timstr2c);
 #endif
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3313,11 +3333,11 @@
 	  (void) sh_unix_gmttime (theFile->atime,   timstr2a, sizeof(timstr2a));
 #ifdef SH_USE_XML
-	  sl_snprintf(tmp, SH_BUFSIZE, _("atime_old=\"%s\" atime_new=\"%s\" "),
+	  sl_snprintf(tmp, SH_MSG_BUF, _("atime_old=\"%s\" atime_new=\"%s\" "),
 		      timstr1a, timstr2a);
 #else
-	  sl_snprintf(tmp, SH_BUFSIZE, _("atime_old=<%s>, atime_new=<%s>, "),
+	  sl_snprintf(tmp, SH_MSG_BUF, _("atime_old=<%s>, atime_new=<%s>, "),
 		      timstr1a, timstr2a);
 #endif
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3331,11 +3351,11 @@
 	  (void) sh_unix_gmttime (theFile->mtime,   timstr2m, sizeof(timstr2m));
 #ifdef SH_USE_XML
-	  sl_snprintf(tmp, SH_BUFSIZE, _("mtime_old=\"%s\" mtime_new=\"%s\" "),
+	  sl_snprintf(tmp, SH_MSG_BUF, _("mtime_old=\"%s\" mtime_new=\"%s\" "),
 		      timstr1m, timstr2m);
 #else
-	  sl_snprintf(tmp, SH_BUFSIZE, _("mtime_old=<%s>, mtime_new=<%s>, "),
+	  sl_snprintf(tmp, SH_MSG_BUF, _("mtime_old=<%s>, mtime_new=<%s>, "),
 		      timstr1m, timstr2m);
 #endif
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3347,5 +3367,5 @@
       if ((modi_mask & MODI_CHK) != 0)
 	{
-	  sl_snprintf(tmp, SH_BUFSIZE, 
+	  sl_snprintf(tmp, SH_MSG_BUF, 
 #ifdef SH_USE_XML
 		      _("chksum_old=\"%s\" chksum_new=\"%s\" "),
@@ -3354,5 +3374,5 @@
 #endif
 		      p->theFile.checksum, fileHash);
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3381,13 +3401,13 @@
 	    tmp_lnk_old = sh_util_strdup("-");
 #ifdef SH_USE_XML
-	  sl_snprintf(tmp, SH_BUFSIZE, _("link_old=\"%s\" link_new=\"%s\" "),
+	  sl_snprintf(tmp, SH_MSG_BUF, _("link_old=\"%s\" link_new=\"%s\" "),
 		      tmp_lnk_old, tmp_lnk);
 #else
-	  sl_snprintf(tmp, SH_BUFSIZE, _("link_old=<%s>, link_new=<%s>"),
+	  sl_snprintf(tmp, SH_MSG_BUF, _("link_old=<%s>, link_new=<%s>"),
 		      tmp_lnk_old, tmp_lnk);
 #endif
 	  SH_FREE(tmp_lnk);
 	  SH_FREE(tmp_lnk_old);
-	  sl_strlcat(msg, tmp, SH_BUFSIZE); 
+	  sl_strlcat(msg, tmp, SH_MSG_BUF); 
 #ifdef REPLACE_OLD
 	  if (sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE)
@@ -3908,5 +3928,7 @@
 				       (unsigned char *)linkpath, 
 				       strlen(linkpath));
+
       clen = dlen * 2 + 1;
+
       do {
 	if (decompressed)
@@ -3920,4 +3942,5 @@
 	  { fprintf(stderr, _("Error: Data corrupt or incomplete\n")); return -1; }
       } while (res == Z_BUF_ERROR || clen == clen_o);
+
       decompressed[clen] = '\0';
       fputs( (char*) decompressed, stdout);
@@ -3957,5 +3980,5 @@
     }
 
-  line = SH_ALLOC(MAX_PATH_STORE+1);
+  line = SH_ALLOC(MAX_PATH_STORE+2);
 
   if ( SL_ISERROR(fd = sl_open_read(db_file, SL_YESPRIV))) 
@@ -3969,9 +3992,9 @@
   /* fast forward to start of data
    */
-  sh_hash_setdataent(fd, line, MAX_PATH_STORE, db_file);
+  sh_hash_setdataent(fd, line, MAX_PATH_STORE+1, db_file);
 
   while (1) 
     {
-      p = sh_hash_getdataent (fd, line, MAX_PATH_STORE);
+      p = sh_hash_getdataent (fd, line, MAX_PATH_STORE+1);
       if ((p != NULL) && (p->fullpath[0] == '/'))
 	{
@@ -4022,5 +4045,5 @@
   if (flag == 0)
     {
-      fprintf(stderr, _("No file found\n"));
+      fprintf(stderr, _("File not found\n"));
       _exit(EXIT_FAILURE);
     }
Index: trunk/src/sh_html.c
===================================================================
--- trunk/src/sh_html.c	(revision 169)
+++ trunk/src/sh_html.c	(revision 170)
@@ -277,5 +277,5 @@
 
 static
-int sh_html_get_entry ()
+int sh_html_get_entry (void)
 {
   long      retval = SL_ENONE;
@@ -390,6 +390,6 @@
 int comp_arr (const void * ao, const void * bo)
 {
-  sort_arr * a;
-  sort_arr * b;
+  const sort_arr * a;
+  const sort_arr * b;
 
   if (ao == NULL && bo == NULL)
@@ -400,6 +400,6 @@
     return (1);
 
-  a = (sort_arr *) ao;
-  b = (sort_arr *) bo;
+  a = (const sort_arr *) ao;
+  b = (const sort_arr *) bo;
 
   return ((-1) * sl_strcmp(a->tim, b->tim));
Index: trunk/src/sh_ignore.c
===================================================================
--- trunk/src/sh_ignore.c	(revision 169)
+++ trunk/src/sh_ignore.c	(revision 170)
@@ -157,5 +157,5 @@
 }
 
-int sh_ignore_clean ()
+int sh_ignore_clean (void)
 {
   struct sh_ignore_list * new;
Index: trunk/src/sh_mail.c
===================================================================
--- trunk/src/sh_mail.c	(revision 169)
+++ trunk/src/sh_mail.c	(revision 170)
@@ -131,6 +131,6 @@
     }
 
-  buf     = SH_ALLOC( (size_t)(SH_BUFSIZE+1));
-  bufc    = SH_ALLOC( (size_t)(SH_MAXBUF+1));
+  buf     = SH_ALLOC( (size_t)(SH_MSG_BUF+SH_BUFSIZE+1));
+  bufc    = SH_ALLOC( (size_t)(SH_MSG_BUF+SH_MAXBUF+1));
 
   while (1 == 1)
@@ -144,5 +144,5 @@
 			     sizeof("-----BEGIN MESSAGE-----")-1)) 
 	{
-	  (void) sh_unix_getline (fd, buf, SH_BUFSIZE);
+	  (void) sh_unix_getline (fd, buf, SH_MSG_BUF+SH_BUFSIZE);
 	  if (buf[0] == '\0')
 	    {
@@ -163,5 +163,5 @@
       while (1 == 1)
 	{
-	  (void) sh_unix_getline (fd, buf, SH_BUFSIZE);
+	  (void) sh_unix_getline (fd, buf, SH_MSG_BUF+SH_BUFSIZE);
 	  if (0 == sl_strncmp(buf, _("-----BEGIN SIGNATURE-----"),
 			      sizeof("-----BEGIN SIGNATURE-----")-1))
@@ -169,5 +169,5 @@
 	  if (buf[0] == '\0') 
 	    _exit (EXIT_FAILURE);
-	  (void) sh_util_compress(bufc, buf, SH_MAXBUF-KEY_LEN);
+	  (void) sh_util_compress(bufc, buf, SH_MSG_BUF+SH_MAXBUF-KEY_LEN);
 	}
       
@@ -283,5 +283,5 @@
   size_t  s;
 
-  char  * dup;
+  char  * dupp;
   char  * p;
   char  * end;
@@ -314,6 +314,6 @@
   *ntok = 0;
 
-  dup = sh_util_strdup(argstring);
-  p   = dup;
+  dupp = sh_util_strdup(argstring);
+  p   = dupp;
 
   do
@@ -369,5 +369,5 @@
 
   *ntok = i;
-  SH_FREE(dup);
+  SH_FREE(dupp);
 
   SL_RETURN (0, _("sh_filter_filteradd"));
@@ -1888,5 +1888,5 @@
   HEADER * header;
   int      type, rdlength, pref;
-  unsigned int count, index;
+  unsigned int count, theindex;
   dnsrep * retval;
 
@@ -1953,5 +1953,5 @@
    */
   count = ntohs (header->qdcount); 
-  for (index = 0; index < count; ++index)
+  for (theindex = 0; theindex < count; ++theindex)
     {
       ret = dn_skipname (comp_dn, eom);
@@ -2101,8 +2101,8 @@
 static dnsrep * return_mx (char *domain)
 {
-  struct hostent *host = NULL;
+  struct hostent *host;
   dnsrep * answers = NULL;
   mx     * result;
-  dnsrep * retval  = NULL;
+  dnsrep * retval;
   char     errmsg[128];
   size_t   len;
@@ -2144,4 +2144,8 @@
 
       SH_MUTEX_LOCK(mutex_resolv);
+
+      host   = NULL;
+      retval = NULL;
+
       if (domain != NULL)
 	host = /*@-unrecog@*/sh_gethostbyname (domain)/*@+unrecog@*/;
Index: trunk/src/sh_mem.c
===================================================================
--- trunk/src/sh_mem.c	(revision 169)
+++ trunk/src/sh_mem.c	(revision 170)
@@ -43,5 +43,5 @@
 #include "sh_pthread.h"
 
-extern int safe_logger (int signal, int method, char * details);
+extern int safe_logger (int thesignal, int method, char * details);
 
 #undef  FIL__
@@ -258,10 +258,10 @@
 
 
-void sh_mem_free (void * a, char * file, int line)
-{
-  volatile memlist_t * this   = memlist;
-  volatile memlist_t * before = memlist;
+void sh_mem_free (void * aa, char * file, int line)
+{
+  memlist_t * this;
+  memlist_t * before;
   unsigned long        size   = 0;
-
+  void      * a;
   SL_ENTER(_("sh_mem_free"));
 
@@ -269,4 +269,8 @@
   SH_MUTEX_RECURSIVE_LOCK(mutex_mem);
 
+  a      = aa;
+  this   = memlist;
+  before = memlist;
+  
   if ( a == NULL ) 
     {
@@ -315,5 +319,5 @@
   free(a);
   if (this)
-    free((void*)this);
+    free(this);
   ++Free_Count;
   --Now_Alloc_Count;
Index: trunk/src/sh_portcheck.c
===================================================================
--- trunk/src/sh_portcheck.c	(revision 169)
+++ trunk/src/sh_portcheck.c	(revision 170)
@@ -179,6 +179,4 @@
     }
 
-  val = (val <= 0 ? 60 : val);
-
   sh_portchk_interval = (time_t) val;
   SL_RETURN(0, _("sh_portchk_set_interval"));
@@ -251,13 +249,13 @@
 /* Interface to initialize port check
  */
-int sh_portchk_init ();
+int sh_portchk_init (struct mod_type * arg);
 
 /* Interface to reset port check
  */
-int sh_portchk_reset ();
+int sh_portchk_reset (void);
 
 /* Interface to run port check
  */
-int sh_portchk_check ();
+int sh_portchk_check (void);
 
 
@@ -317,5 +315,5 @@
  * Thereafter, we check for entries that are still UNKN.
  */
-static void sh_portchk_reset_lists ()
+static void sh_portchk_reset_lists (void)
 {
   struct sh_portentry * portlist;
@@ -364,4 +362,12 @@
 }
   
+/* These variables are not used anywhere. They only exist
+ * to assign &pre, &ptr to them, which keeps gcc from
+ * putting it into a register, and avoids the 'clobbered
+ * by longjmp' warning. And no, 'volatile' proved insufficient.
+ */
+static void * sh_dummy_pre = NULL;
+static void * sh_dummy_ptr = NULL;
+
 /* check the list of open ports for any that are marked as UNKN
  */
@@ -372,4 +378,10 @@
   char errbuf[256];
 
+  /* Take the address to keep gcc from putting them into registers. 
+   * Avoids the 'clobbered by longjmp' warning. 
+   */
+  sh_dummy_pre = (void*) &pre;
+  sh_dummy_ptr = (void*) &ptr;
+ 
   while (ptr)
     {
@@ -817,6 +829,6 @@
 	  flags = retry_fcntl(FIL__, __LINE__, fd, F_GETFL, 0);
 	  retry_fcntl(FIL__, __LINE__, fd, F_SETFL, flags | O_NONBLOCK);
-	  write (fd, _("SSH-2.0-Foobar"), 14);
-	  write (fd, "\r\n", 2);
+	  retval = write (fd, _("SSH-2.0-Foobar"), 14);
+	  if (retval > 0) retval = write (fd, "\r\n", 2);
 	}
       else if (port == 25)  /* smtp */
@@ -824,6 +836,6 @@
 	  flags = retry_fcntl(FIL__, __LINE__, fd, F_GETFL, 0);
 	  retry_fcntl(FIL__, __LINE__, fd, F_SETFL, flags | O_NONBLOCK);
-	  write (fd, _("QUIT"), 4);
-	  write (fd, "\r\n", 2);
+	  retval = write (fd, _("QUIT"), 4);
+	  if (retval > 0) retval = write (fd, "\r\n", 2);
 	}
       else if (port == 79)  /* finger */
@@ -831,5 +843,5 @@
 	  flags = retry_fcntl(FIL__, __LINE__, fd, F_GETFL, 0);
 	  retry_fcntl(FIL__, __LINE__, fd, F_SETFL, flags | O_NONBLOCK);
-	  write (fd, "\r\n", 2);
+	  retval = write (fd, "\r\n", 2);
 	}
       else if (port == 110) /* pop3 */
@@ -837,6 +849,6 @@
 	  flags = retry_fcntl(FIL__, __LINE__, fd, F_GETFL, 0);
 	  retry_fcntl(FIL__, __LINE__, fd, F_SETFL, flags | O_NONBLOCK);
-	  write (fd, _("QUIT"), 4);
-	  write (fd, "\r\n", 2);
+	  retval = write (fd, _("QUIT"), 4);
+	  if (retval > 0) retval = write (fd, "\r\n", 2);
 	}
       else if (port == 143) /* imap */
@@ -844,7 +856,11 @@
 	  flags = retry_fcntl(FIL__, __LINE__, fd, F_GETFL, 0);
 	  retry_fcntl(FIL__, __LINE__, fd, F_SETFL, flags | O_NONBLOCK);
-	  write (fd, _("A01 LOGOUT"), 10);
-	  write (fd, "\r\n", 2);
-	}
+	  retval = write (fd, _("A01 LOGOUT"), 10);
+	  if (retval > 0) retval = write (fd, "\r\n", 2);
+	}
+
+      if (portchk_debug && retval < 0)
+	fprintf(stderr, _("check port: error writing to port %5d\n"), 
+		port);
      }
   close (fd);
@@ -878,5 +894,5 @@
 {
   struct hostent * hent;
-  int              i = 0;
+  volatile int     i; /* might be clobbered by âlongjmpâ or âvforkâ*/
   char errbuf[256];
 
@@ -899,5 +915,5 @@
   SH_MUTEX_LOCK(mutex_resolv);
   hent = sh_gethostbyname(portchk_hostname);
-
+  i = 0;
   while (hent && hent->h_addr_list[i] && (iface_list.used < SH_IFACE_MAX))
     {
@@ -945,5 +961,5 @@
 
 #if !defined(TEST_ONLY)
-int sh_portchk_reconf ()
+int sh_portchk_reconf (void)
 {
   SH_MUTEX_LOCK(mutex_port_check);
@@ -962,5 +978,5 @@
 }
 
-int sh_portchk_cleanup ()
+int sh_portchk_cleanup (void)
 {
   return sh_portchk_reconf ();
@@ -983,5 +999,5 @@
 static int check_port_generic (int port, int type, int protocol)
 {
-  int              i    =  0;
+  volatile int     i    =  0;
   int              sock = -1;
   int              flag =  1; /* non-zero to enable an option */
@@ -1002,4 +1018,5 @@
       if ((sock = socket(AF_INET, type, protocol)) < 0 )
 	{
+	  ++i;
 #ifdef TEST_ONLY
 	  if (portchk_debug)
@@ -1010,11 +1027,11 @@
 			  sh_error_message(errno, errbuf, sizeof(errbuf)), _("socket"));
 	  SH_MUTEX_UNLOCK(mutex_thread_nolog);
-	  ++i;
+#endif
 	  continue;
-#endif
 	}
       if ( setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
 		      (void *) &flag, sizeof(flag)) < 0 )
 	{
+	  ++i;
 #ifdef TEST_ONLY
 	  if (portchk_debug)
@@ -1026,5 +1043,4 @@
 	  SH_MUTEX_UNLOCK(mutex_thread_nolog);
 #endif
-	  ++i;
 	  continue;
 	}
@@ -1056,5 +1072,5 @@
 
 
-static int sh_portchk_scan_ports_generic (int min_port, int max_port, int type, int protocol)
+static int sh_portchk_scan_ports_generic (int min_port, int max_port_arg, int type, int protocol)
 {
   /*
@@ -1063,5 +1079,6 @@
   */
 
-  int port;
+  volatile int port; /*  might be clobbered by âlongjmpâ or âvforkâ*/
+  volatile int max_port = max_port_arg;
   int retval;
   int sock   = -1;
@@ -1444,7 +1461,10 @@
 int sh_portchk_check ()
 {
-  int min_port = 0;
+  volatile int min_port;
 
   SH_MUTEX_LOCK(mutex_port_check);
+
+  min_port = 0;
+
   if (sh_portchk_active != S_FALSE)
     {
Index: trunk/src/sh_prelude.c
===================================================================
--- trunk/src/sh_prelude.c	(revision 169)
+++ trunk/src/sh_prelude.c	(revision 170)
@@ -723,4 +723,6 @@
 	*tmp = '\0';
 
+	/* Get interface 
+	 */
 	ip = strdup(ptr);
         if ( ip ) {
@@ -769,4 +771,6 @@
 	*tmp = '\0';
 
+	/* Get port number
+	 */
 	port = strtol(ptr, &end, 0);
         if ( *ptr && *end == '\0' && port >= 0 && port < 65536) {
@@ -810,4 +814,6 @@
 	*tmp = '\0';
 
+	/* Get service
+	 */
 	srv = strdup(ptr);
         if ( srv ) {
@@ -830,5 +836,5 @@
                 }
 
-                ret = idmef_service_new_ident(service, &str);
+                ret = idmef_service_new_name(service, &str);
                 if ( ret < 0 ) {
                         free(srv);
Index: trunk/src/sh_processcheck.c
===================================================================
--- trunk/src/sh_processcheck.c	(revision 169)
+++ trunk/src/sh_processcheck.c	(revision 170)
@@ -394,4 +394,11 @@
 } 
 
+/* These variables are not used anywhere. They only exist
+ * to assign &userold, &user to them, which keeps gcc from
+ * putting them into a register, and avoids the 'clobbered
+ * by longjmp' warning. And no, 'volatile' proved insufficient.
+ */
+static void * sh_dummy_watchlist = NULL;
+
 static void check_watchlist (short * res)
 {
@@ -399,4 +406,9 @@
   char * tmp;
   size_t indx;
+
+  /* Take the address to keep gcc from putting them into registers. 
+   * Avoids the 'clobbered by longjmp' warning. 
+   */
+  sh_dummy_watchlist = (void*) &list;
 
   while (list) 
@@ -409,7 +421,8 @@
 	    {
 	      SH_MUTEX_LOCK(mutex_thread_nolog);
+	      tmp = sh_util_safe_name (list->str);
 	      sh_error_handle(sh_prochk_severity, FIL__, __LINE__, 0, 
 			      MSG_PCK_MISS,
-			      list->str);
+			      tmp);
 	      SH_MUTEX_UNLOCK(mutex_thread_nolog);
 	    }
@@ -428,6 +441,6 @@
 	      if (S_FALSE == is_in_list(&list_missing, list->str, 0))
 		{
+		  SH_MUTEX_LOCK(mutex_thread_nolog);
 		  tmp = sh_util_safe_name (list->str);
-		  SH_MUTEX_LOCK(mutex_thread_nolog);
 		  sh_error_handle(sh_prochk_severity, FIL__, __LINE__, 0, 
 				  MSG_PCK_MISS, 
@@ -594,6 +607,4 @@
     }
 
-  val = (val <= 0 ? 60 : val);
-
   sh_prochk_interval = (time_t) val;
   SL_RETURN(0, _("sh_prochk_set_interval"));
@@ -625,4 +636,5 @@
 static int proc_max_pid (size_t * procpid)
 {
+  char * ret;
   unsigned long  pid;
   FILE * fd;
@@ -640,6 +652,6 @@
 	{
 	  str[0] = '\0';
-	  fgets(str, 128, fd);
-	  if (*str != '\0')
+	  ret = fgets(str, 128, fd);
+	  if (ret && *str != '\0')
 	    {
 	      pid = strtoul(str, &ptr, 0);
@@ -1055,7 +1067,8 @@
 static int sh_process_check_int (short * res)
 {
-  size_t i, j;
+  volatile size_t i;
+  size_t j;
   char  tests[512];
-  int   retval;
+  volatile int   retval;
 
   pid_t this_pid;
@@ -1207,5 +1220,5 @@
 /* Initialise. 
  */
-static int sh_prochk_init_internal() 
+static int sh_prochk_init_internal(void) 
 {
   SL_ENTER(_("sh_prochk_init"));
@@ -1267,9 +1280,12 @@
 int sh_prochk_check(void) 
 {
-  int status = 0;
+  int status;
 
   SL_ENTER(_("sh_prochk_check"));
 
   SH_MUTEX_LOCK(mutex_proc_check);
+
+  status = 0;
+
   if( ShProchkActive != S_FALSE )
     {
Index: trunk/src/sh_pthread.c
===================================================================
--- trunk/src/sh_pthread.c	(revision 169)
+++ trunk/src/sh_pthread.c	(revision 170)
@@ -22,9 +22,9 @@
 }
 
-int sh_pthread_init_threadspecific()
+int sh_pthread_init_threadspecific(void)
 {
   int rc = 0;
 #ifdef SH_STEALTH
-  extern int sh_g_thread();
+  extern int sh_g_thread(void);
 
   rc = sh_g_thread();
Index: trunk/src/sh_readconf.c
===================================================================
--- trunk/src/sh_readconf.c	(revision 169)
+++ trunk/src/sh_readconf.c	(revision 170)
@@ -96,5 +96,5 @@
 
 typedef struct str_ListSections {
-  char * name;
+  const char * name;
   int    type;
 } sh_str_ListSections;
@@ -721,5 +721,5 @@
 
 typedef struct _cfg_options {
-  char * optname;
+  const char * optname;
   ShSectionType   section;
   ShSectionType   alt_section;
@@ -1111,5 +1111,5 @@
 {
   char * key;
-  char * value;
+  const char * value;
   char * tmp;
   int    i;
@@ -1120,12 +1120,12 @@
 #endif
 
-  static char  *dummy = N_("dummy");
-
-  static char  *closing[] = {
+  static const char  *dummy = N_("dummy");
+
+  static const char  *closing[] = {
     N_("closecommand"),
     NULL
   };
 
-  static char  *ident[] = {
+  static const char  *ident[] = {
     N_("severityreadonly"),
     N_("severitylogfiles"),
Index: trunk/src/sh_socket.c
===================================================================
--- trunk/src/sh_socket.c	(revision 169)
+++ trunk/src/sh_socket.c	(revision 170)
@@ -178,5 +178,5 @@
 static void sh_socket_add2list (struct socket_cmd * in);
 
-static void sh_socket_probe4reload ()
+static void sh_socket_probe4reload (void)
 {
   struct reload_cmd  * new;
@@ -222,5 +222,5 @@
 }
 
-char * sh_get_sockpass ()
+char * sh_get_sockpass (void)
 {
   size_t j = 0;
@@ -236,5 +236,5 @@
 }
 
-void sh_set_sockpass ()
+void sh_set_sockpass (void)
 {
   int j;
Index: trunk/src/sh_static.c
===================================================================
--- trunk/src/sh_static.c	(revision 169)
+++ trunk/src/sh_static.c	(revision 170)
@@ -283,4 +283,9 @@
 }
 
+struct passwd * getpwuid(uid_t uid)
+{
+        return sh_getpwuid(uid);
+}
+
 struct group * sh_getgrgid(gid_t gid)
 {
@@ -293,4 +298,8 @@
 }
 
+struct group * getgrgid(gid_t gid)
+{
+        return sh_getgrgid(gid);
+}
 
 struct passwd * sh_getpwnam(const char *name)
@@ -1560,5 +1569,5 @@
 }
 
-static int __open_nameservers()
+static int __open_nameservers(void)
 {
 	FILE *fp;
@@ -1887,5 +1896,5 @@
 
 	if(type == AF_INET) {
-		unsigned char *tmp_addr = (unsigned char *)addr;
+		const unsigned char *tmp_addr = (const unsigned char *)addr;
 
 		memcpy(&in->s_addr, addr, len);
Index: trunk/src/sh_suidchk.c
===================================================================
--- trunk/src/sh_suidchk.c	(revision 169)
+++ trunk/src/sh_suidchk.c	(revision 170)
@@ -859,10 +859,10 @@
   int             fflags;
   char          * fs;
-  long            sl_status = SL_ENONE;
+  long            sl_status;
   file_type       theFile;
   char            fileHash[2*(KEY_LEN + 1)];
 
-  struct sh_dirent * dirlist = NULL;
-  struct sh_dirent * dirlist_orig = NULL;
+  struct sh_dirent * dirlist;
+  struct sh_dirent * dirlist_orig;
   char errbuf[SH_ERRBUF_SIZE];
 
@@ -896,4 +896,7 @@
   SH_MUTEX_LOCK(mutex_readdir);
 
+  dirlist      = NULL;
+  dirlist_orig = NULL;
+
   do {
 
@@ -918,4 +921,6 @@
 
   dirlist_orig = dirlist;
+
+  sl_status = SL_ENONE;
 
   do {
@@ -1345,5 +1350,5 @@
 
 
-static void sh_suidchk_free_schedule ()
+static void sh_suidchk_free_schedule (void)
 {
   sh_schedule_t * current = ShSuidchkSched;
Index: trunk/src/sh_tiger0.c
===================================================================
--- trunk/src/sh_tiger0.c	(revision 169)
+++ trunk/src/sh_tiger0.c	(revision 170)
@@ -64,6 +64,6 @@
 #if defined(TIGER_64_BIT)
 
-void tiger_t(word64 *str, word64 length, word64 * res);
-void tiger(word64 *str, word64 length, word64 * res);
+void tiger_t(const word64 *str, word64 length, word64 * res);
+void tiger(const word64 *str, word64 length, word64 * res);
 
 #ifdef TIGER_DBG
@@ -75,6 +75,6 @@
 #endif
 #else
-void tiger(sh_word32 *str, sh_word32 length, sh_word32 * res);
-void tiger_t(sh_word32 *str, sh_word32 length, sh_word32 * res);
+void tiger(const sh_word32 *str, sh_word32 length, sh_word32 * res);
+void tiger_t(const sh_word32 *str, sh_word32 length, sh_word32 * res);
 
 #ifdef TIGER_DBG
@@ -139,5 +139,5 @@
 
 #if defined(TIGER_64_BIT)
-#define TIGER_CAST (word64*)
+#define TIGER_CAST (const word64*)
   /* word64 res[3]; */
   res[0]= (word64) 0x0123456789ABCDEFLL;
@@ -145,5 +145,5 @@
   res[2]= (word64) 0xF096A5B4C3B2E187LL;
 #else
-#define TIGER_CAST (sh_word32*)
+#define TIGER_CAST (const sh_word32*)
   /* sh_word32 res[6]; */
   res[0]= (sh_word32) 0x89ABCDEF;
Index: trunk/src/sh_tiger1.c
===================================================================
--- trunk/src/sh_tiger1.c	(revision 169)
+++ trunk/src/sh_tiger1.c	(revision 170)
@@ -267,5 +267,5 @@
 
 void
-tiger_t(sh_word32 *str, sh_word32 length, sh_word32 res[6])
+tiger_t(const sh_word32 *str, sh_word32 length, sh_word32 res[6])
 {
   register sh_word32 i;
Index: trunk/src/sh_tiger1_64.c
===================================================================
--- trunk/src/sh_tiger1_64.c	(revision 169)
+++ trunk/src/sh_tiger1_64.c	(revision 170)
@@ -404,5 +404,5 @@
 }
 
-void tiger(word64 *str, word64 length, word64 res[3])
+void tiger(const word64 *str, word64 length, word64 res[3])
 {
   register word64 i;
Index: trunk/src/sh_tools.c
===================================================================
--- trunk/src/sh_tools.c	(revision 169)
+++ trunk/src/sh_tools.c	(revision 170)
@@ -475,7 +475,7 @@
   char   * host_name;
 
-  int    fd = (-1);
+  volatile int    fd = (-1);
   int    status;
-  int    fail   = 0;
+  volatile int    fail   = 0;
   int    cached = 0;
 
@@ -522,7 +522,7 @@
 #endif
 	{
+	  SH_MUTEX_LOCK(mutex_resolv);
+
 	  host_name = NULL;
-
-	  SH_MUTEX_LOCK(mutex_resolv);
 
 	  host_entry = sh_gethostbyname(address);
Index: trunk/src/sh_unix.c
===================================================================
--- trunk/src/sh_unix.c	(revision 169)
+++ trunk/src/sh_unix.c	(revision 170)
@@ -356,5 +356,5 @@
 extern int OnlyStderr; 
 
-int safe_logger (int signal, int method, char * details)
+int safe_logger (int thesignal, int method, char * details)
 {
   unsigned int i = 0;
@@ -396,5 +396,5 @@
   if (p && *p)
     sl_strlcat(msg, p, 128);
-  if (signal == 0)
+  if (thesignal == 0)
     {
       if (details == NULL) {
@@ -408,5 +408,5 @@
     {
       sl_strlcat(msg, _("]: exit on signal "), 128);
-      p = safe_itoa(signal, str, 128);
+      p = safe_itoa(thesignal, str, 128);
       if (p && *p)
 	sl_strlcat(msg, p, 128);
@@ -461,11 +461,11 @@
 }
 
-void safe_fatal (char * details, 
-		 char * file, int line)
+void safe_fatal (const char * details, 
+		 const char * file, int line)
 {
   char msg[128];
   char str[128];
   char * p;
-  int  signal = 0;
+  int  thesignal = 0;
   int  method = 0;
 
@@ -479,5 +479,5 @@
   }
   sl_strlcat(msg, details, 128);
-  (void) safe_logger (signal, method, msg);
+  (void) safe_logger (thesignal, method, msg);
   _exit(EXIT_FAILURE);
 }
@@ -1060,6 +1060,6 @@
 }
 
-extern uid_t   sl_trust_baduid();
-extern gid_t   sl_trust_badgid();
+extern uid_t   sl_trust_baduid(void);
+extern gid_t   sl_trust_badgid(void);
 
 #if defined(HOST_IS_CYGWIN) || defined(__cygwin__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
@@ -1562,5 +1562,5 @@
   struct hostent * he1;
   int              i;
-  int              ddot = 0;
+  int              ddot;
   int              len;
   char           * p;
@@ -1632,4 +1632,5 @@
    */
   len = sl_strlen(sh.host.name);
+  ddot = 0;
   for (i = 0; i < len; ++i) 
     if (sh.host.name[i] == '.') ++ddot; 
@@ -1660,5 +1661,5 @@
   struct hostent * he1;
   int              i;
-  int              ddot = 0;
+  int              ddot;
   int              len;
   char             hostname[1024];
@@ -1691,4 +1692,5 @@
    */
   len = sl_strlen(sh.host.name);
+  ddot = 0;
   for (i = 0; i < len; ++i) 
     if (sh.host.name[i] == '.') ++ddot; 
@@ -1772,5 +1774,5 @@
 }
 
-int sh_unix_chroot()
+int sh_unix_chroot(void)
 {
   int status;
@@ -1794,5 +1796,5 @@
 /* #ifdef SH_WITH_SERVER */
 #else
-int sh_unix_chroot() { return 0; }
+int sh_unix_chroot(void) { return 0; }
 #endif
 
@@ -1850,5 +1852,5 @@
   pid_t  oldpid = getpid();
 #if defined(SH_WITH_SERVER) 
-  extern int sh_socket_open_int ();
+  extern int sh_socket_open_int (void);
 #endif
   char errbuf[SH_ERRBUF_SIZE];
@@ -3411,5 +3413,5 @@
 	      UINT64 length_nolim = TIGER_NOLIM;
 
-	      if ((theFile->check_mask & MODI_TXT) != 0 && fbuf.st_size < (10 * SH_TXT_MAX))
+	      if (MODI_TXT_ENABLED(theFile->check_mask) && fbuf.st_size < (10 * SH_TXT_MAX))
 		{
 		  sl_init_content (rval_open, fbuf.st_size);
@@ -3464,5 +3466,5 @@
 	      UINT64 length_nolim = TIGER_NOLIM;
 
-	      if ((theFile->check_mask & MODI_TXT) != 0 && fbuf.st_size < (10 * SH_TXT_MAX))
+	      if (MODI_TXT_ENABLED(theFile->check_mask) && fbuf.st_size < (10 * SH_TXT_MAX))
 		{
 		  sl_init_content (rval_open, fbuf.st_size);
@@ -4301,5 +4303,5 @@
 SH_MUTEX_STATIC(mutex_mlock,PTHREAD_MUTEX_INITIALIZER);
 
-int sh_unix_mlock (char * file, int line, void * in_addr, size_t len)
+int sh_unix_mlock (const char * file, int line, void * in_addr, size_t len)
 {
   int         num_pages;
Index: trunk/src/sh_utils.c
===================================================================
--- trunk/src/sh_utils.c	(revision 169)
+++ trunk/src/sh_utils.c	(revision 170)
@@ -313,5 +313,6 @@
 char * sh_util_strsep (char **str, const char *delim) 
 {
-  char *ret, *c, *d;
+  char *ret, *c;
+  const char *d;
 
   SL_ENTER(_("sh_util_strsep"));
@@ -321,5 +322,5 @@
 
   for (c = *str; *c != '\0'; c++) {
-    for (d = (char *) delim; *d != '\0'; d++) {
+    for (d = delim; *d != '\0'; d++) {
       if (*c == *d) {
         *c = '\0';
@@ -1476,5 +1477,5 @@
 
   for (i = 0; i < 6; ++i)
-    bufy[i] = taus_get(&(skey->rng0[0]), &(skey->rng1[0]), &(skey->rng2[0]));
+    bufy[i] = taus_get();
 
   p = sh_tiger_hash ((char *) bufy, TIGER_DATA, 
@@ -1508,5 +1509,5 @@
   const int     sh_val_utf8_4 = 4;
 
-  size_t        len = strlen((char *)str);
+  size_t        len = strlen((const char *)str);
   size_t        l   = 0;
   int           typ = 0;
@@ -2102,5 +2103,5 @@
 	{
 	  if (lin == 0)
-	    lin = strlen((char *)instr);
+	    lin = strlen((const char *)instr);
 
 	  do {
@@ -2149,5 +2150,5 @@
 
   *out = SH_ALLOC(outlen);
-  return sh_util_base64_enc((unsigned char *)*out, (unsigned char *)in, inlen);
+  return sh_util_base64_enc((unsigned char *)*out, (const unsigned char *)in, inlen);
 }
 
@@ -2164,5 +2165,5 @@
     {
       if (lin == 0)
-	lin = strlen((char *)in);
+	lin = strlen((const char *)in);
 
       for (i = 0; i < lin; i++)
@@ -2189,5 +2190,5 @@
 	  else if (c == ')' || c == '/')
 	    {
-	      b = 64;
+	      b = 63;
 	    }
 	  else if (c == '?' || c == '=')
Index: trunk/src/sh_utmp.c
===================================================================
--- trunk/src/sh_utmp.c	(revision 169)
+++ trunk/src/sh_utmp.c	(revision 170)
@@ -472,5 +472,5 @@
  *************/
 
-static int sh_utmp_init_internal ()
+static int sh_utmp_init_internal (void)
 {
 
@@ -516,5 +516,5 @@
  *************/
 #ifdef HAVE_UTTYPE
-static int sh_utmp_login_clean();
+static int sh_utmp_login_clean(void);
 #endif
 
@@ -633,5 +633,4 @@
 int sh_utmp_set_login_timer (const char * c)
 {
-  int retval = 0;
   long val;
 
@@ -644,8 +643,6 @@
 		       _("utmp timer"), c);
       SH_MUTEX_UNLOCK(mutex_thread_nolog);
-      retval = -1;
-    }
-
-  val = (val <= 0 ? 60 : val);
+      SL_RETURN((-1), _("sh_utmp_set_login_timer"));
+    }
 
   ShUtmpInterval = (time_t) val;
@@ -670,5 +667,5 @@
 static struct login_ct * login_ct_list = NULL;
 
-static int sh_utmp_login_clean()
+static int sh_utmp_login_clean(void)
 {
   struct login_ct * list = login_ct_list;
@@ -776,6 +773,6 @@
  * by longjmp' warning. And no, 'volatile' proved insufficient.
  */
-void * sh_dummy_userold = NULL;
-void * sh_dummy_user    = NULL;
+static void * sh_dummy_userold = NULL;
+static void * sh_dummy_user    = NULL;
 
 
@@ -1063,5 +1060,5 @@
   int           error;
   struct SH_UTMP_S * ut;
-  unsigned long this_read = 0;
+  unsigned long this_read;
   int           val_retry;
 
@@ -1123,4 +1120,6 @@
    * we need to do this here
    */
+  this_read = 0;
+
   if (mode < 2)
     {
Index: trunk/src/slib.c
===================================================================
--- trunk/src/slib.c	(revision 169)
+++ trunk/src/slib.c	(revision 170)
@@ -123,5 +123,5 @@
 }
 
-FILE * sl_tracefile_open(char * file, char * mode)
+FILE * sl_tracefile_open(const char * file, const char * mode)
 {
   FILE * xp = NULL;
@@ -132,5 +132,5 @@
 }
 
-void sl_trace_in(char * str, char * file, int line)
+void sl_trace_in(const char * str, const char * file, int line)
 {
   int    i;
@@ -165,5 +165,5 @@
 }
 
-void sl_trace_out(char * str, char * file, int line)
+void sl_trace_out(const char * str, const char * file, int line)
 {
   int    i;
@@ -200,5 +200,5 @@
 }
 
-extern int sh_log_console (char * msg);
+extern int sh_log_console (const char * msg);
 
 static int dlogActive = 0;
@@ -215,5 +215,5 @@
  *      = 3 backtrace
  */
-int dlog (int flag, char * file, int line,  const char *fmt, ...)
+int dlog (int flag, const char * file, int line,  const char *fmt, ...)
 {
   va_list     ap;
@@ -1496,5 +1496,5 @@
  * Do nothing if not SUID.
  */
-int sl_policy_get_user(char * user)
+int sl_policy_get_user(const char * user)
 {
   SL_ENTER(_("sl_policy_get_user"));
@@ -2444,5 +2444,5 @@
 
 
-int sl_write (SL_TICKET ticket, void * msg_in, long nbytes)
+int sl_write (SL_TICKET ticket, const void * msg_in, long nbytes)
 {
   long bytewritten;
@@ -2450,5 +2450,5 @@
   int  fd;
 
-  char * msg; 
+  const char * msg; 
 
   SL_ENTER(_("sl_write"));
@@ -2461,5 +2461,5 @@
     SL_IRETURN(fd, _("sl_write"));
 
-  msg = (char *) msg_in;
+  msg = (const char *) msg_in;
 
   /* write
@@ -2485,5 +2485,5 @@
 }
 
-int sl_write_line (SL_TICKET ticket, void * msg, long nbytes)
+int sl_write_line (SL_TICKET ticket, const void * msg, long nbytes)
 {
   int  status;
@@ -2582,5 +2582,5 @@
 
 
-char * sl_trust_errfile()
+char * sl_trust_errfile(void)
 {
   return &tf_path[0];
@@ -2588,5 +2588,5 @@
 
 extern uid_t tf_baduid;
-uid_t   sl_trust_baduid()
+uid_t   sl_trust_baduid(void)
 {
   return tf_baduid;
@@ -2594,5 +2594,5 @@
 
 extern gid_t tf_badgid;
-gid_t   sl_trust_badgid()
+gid_t   sl_trust_badgid(void)
 {
   return tf_badgid;
@@ -2602,5 +2602,5 @@
 static int trust_count = 0;
 
-int  sl_trust_purge_user ()
+int  sl_trust_purge_user (void)
 {
   int i;
Index: trunk/src/trustfile.c
===================================================================
--- trunk/src/trustfile.c	(revision 169)
+++ trunk/src/trustfile.c	(revision 170)
@@ -781,4 +781,5 @@
 	  register int lsym;	        /* num chars in symlink ref  */
 	  register int i;		/* trustworthy or not?       */
+	  const char * t_const;
 
 	  /*
@@ -821,7 +822,7 @@
 	      /* smack on the /../ 
 	       */
-	      t = "/../";
+	      t_const = "/../";
 	      while(*t && b < &full[MAXFILENAME])
-		*b++ = *t++;
+		*b++ = *t_const++;
 
 	      /* append the symlink referent 
