Index: trunk/src/sh_calls.c
===================================================================
--- trunk/src/sh_calls.c	(revision 583)
+++ trunk/src/sh_calls.c	(revision 1)
@@ -34,5 +34,4 @@
 #include <signal.h>
 #include <sys/socket.h>
-#include <netdb.h>
 #include <netinet/in.h>
 
@@ -51,18 +50,14 @@
 #include "samhain.h"
 #include "sh_error.h"
-#include "sh_ipvx.h"
-#include "sh_sub.h"
-#include "sh_utils.h"
+#include "sh_calls.h"
 
 #undef  FIL__
 #define FIL__  _("sh_calls.c")
 
-extern int flag_err_debug;
-
 char aud_err_message[64];
 
 typedef struct cht_struct 
 {
-  const char           * str;
+  char           * str;
   unsigned long    val;
 } cht_type;
@@ -87,5 +82,5 @@
 /* Set aud functions
  */
-int sh_aud_set_functions(const char * str_s)
+int sh_aud_set_functions(char * str_s)
 {
   int i = 0;
@@ -114,5 +109,5 @@
 /* Need to catch EINTR for these functions.
  */
-long int retry_sigaction(const char * file, int line,
+long int retry_sigaction(char * file, int line,
 			 int signum,  const  struct  sigaction  *act,
 			 struct sigaction *oldact)
@@ -120,5 +115,4 @@
   int error;
   long int val_retry = -1;
-  char errbuf[SH_ERRBUF_SIZE];
   errno              = 0;
 
@@ -132,5 +126,5 @@
   if (val_retry < 0) {
       sh_error_handle ((-1), file, line, error, MSG_ERR_SIGACT, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       (long) signum );
   }
@@ -139,20 +133,13 @@
 }
 
-static struct sh_sockaddr bind_addr;
+static struct in_addr bind_addr;
 static int        use_bind_addr = 0;
 
-int sh_calls_set_bind_addr (const char * str)
-{
-  static int reject = 0;
-
-  if (reject == 1)
-    return (0);
-
-  if (sh.flag.opts == S_TRUE)  
-    reject = 1;
-
-  if (0 == sh_ipvx_aton(str, &bind_addr)) 
-    return -1;
-
+int sh_calls_set_bind_addr (char * str)
+{
+  if (0 == /*@-unrecog@*/inet_aton(str, &bind_addr)/*@+unrecog@*/) 
+    {
+      return -1;
+    }
   use_bind_addr = 1;
   return 0;
@@ -160,11 +147,10 @@
 
 
-long int retry_connect(const char * file, int line, int sockfd, 
+long int retry_connect(char * file, int line, int sockfd, 
 		       struct sockaddr *serv_addr, int addrlen)
 {
   int error;
-  int err_bind = 0;
   long int val_retry = 0;
-  char errbuf[SH_ERRBUF_SIZE];
+  static struct sockaddr_in new_addr;
 
   SL_ENTER(_("retry_connect"));
@@ -172,62 +158,40 @@
   errno = 0;
 
-  if (use_bind_addr) 
-    {
-      int slen = SH_SS_LEN(bind_addr);
-      struct sockaddr *b_addr = sh_ipvx_sockaddr_cast(&bind_addr);
-
-      if (bind_addr.ss_family == AF_INET)
-	b_addr->sa_family = AF_INET;
-#if defined(USE_IPVX)
-      else
-	b_addr->sa_family = AF_INET6;
+  if (0 != use_bind_addr) 
+    {
+      memcpy(&new_addr.sin_addr, &bind_addr, sizeof(struct in_addr));
+      new_addr.sin_family = AF_INET;
+      
+      val_retry = /*@-unrecog@*/bind(sockfd, 
+				     (struct sockaddr*)&new_addr, 
+				     sizeof(struct sockaddr_in))/*@+unrecog@*/;
+    }
+
+  if (val_retry == 0)
+    {
+      do {
+	val_retry = 
+	  /*@-unrecog@*/connect(sockfd, serv_addr, addrlen)/*@+unrecog@*/;
+      } while (val_retry < 0 && errno == EINTR);
+    }
+
+  error = errno;
+  if (val_retry != 0) {
+    /* ugly cast back to struct sockaddr_in :-(
+     */
+    sh_error_handle ((-1), file, line, error, MSG_ERR_CONNECT, 
+		     sh_error_message(error),
+		     (long) sockfd,
+		     /*@-unrecog -type@*/
+		     (long) ntohs(((struct sockaddr_in *)serv_addr)->sin_port),
+		     /*@+unrecog +type@*/
+#ifdef HAVE_INET_ATON
+		     /*@-unrecog -type@*/
+		     inet_ntoa( ((struct sockaddr_in *)serv_addr)->sin_addr )
+		     /*@+unrecog +type@*/
+#else
+		     _("unknown")
 #endif
-      val_retry = bind(sockfd, b_addr, slen);
-    }
-
-  if (val_retry == 0)
-    {
-      do {
-	val_retry = connect(sockfd, serv_addr, addrlen);
-      } while (val_retry < 0 && (errno == EINTR || errno == EINPROGRESS));
-    }
-  else
-    {
-      err_bind = 1;
-    }
-
-  error = errno;
-  if (val_retry != 0) {
-    long eport = 0;
-    char eaddr[SH_IP_BUF];
-    char emesg[SH_BUFSIZE];
-    struct sockaddr *err_addr = serv_addr;
-    struct sh_sockaddr ss;
-
-    if (err_bind)
-      err_addr = sh_ipvx_sockaddr_cast(&bind_addr);
-
-    sh_ipvx_save(&ss, err_addr->sa_family, err_addr);
-    sh_ipvx_ntoa(eaddr, sizeof(eaddr), &ss);
-    
-    if (err_addr->sa_family == AF_INET)
-      eport = (long) ntohs(((struct sockaddr_in *)serv_addr)->sin_port);
-#if defined(USE_IPVX)
-    else
-      eport = (long) ntohs(((struct sockaddr_in6 *)serv_addr)->sin6_port);
-#endif
-
-    sl_strlcpy(emesg, sh_error_message(error, errbuf, sizeof(errbuf)), sizeof(emesg));
-    sl_strlcat(emesg, 
-	       (err_addr->sa_family == AF_INET) ? _(", AF_INET") : _(", AF_INET6"),
-	       sizeof(emesg));
-
-    sl_strlcat(emesg, 
-	       (err_bind) ? _(", bind") : _(", connect"),
-	       sizeof(emesg));
-    
-    sh_error_handle ((-1), file, line, error, MSG_ERR_CONNECT,
-		     emesg,
-		     (long) sockfd, eport, eaddr);
+		     );
   }
   errno = error;    
@@ -235,13 +199,10 @@
 }
 
-long int retry_accept(const char * file, int line, int fd, 
-		      struct sh_sockaddr *serv_addr, int * addrlen)
+long int retry_accept(char * file, int line, int fd, 
+		      struct sockaddr *serv_addr, int * addrlen)
 {
   int  error;
   long int val_retry = -1;
-  char errbuf[SH_ERRBUF_SIZE];
-  struct sockaddr_storage ss;
-
-  ACCEPT_TYPE_ARG3 my_addrlen = sizeof(ss);
+  ACCEPT_TYPE_ARG3 my_addrlen = (ACCEPT_TYPE_ARG3) *addrlen;
 
   errno              = 0;
@@ -250,193 +211,65 @@
 
   do {
-    val_retry = accept(fd, (struct sockaddr *)&ss, &my_addrlen);
+    val_retry = /*@-unrecog@*/accept(fd, serv_addr, &my_addrlen)/*@+unrecog@*/;
   } while (val_retry < 0 && errno == EINTR);
-
+  *addrlen = (int) my_addrlen;
   error = errno;
   if (val_retry < 0) {
       sh_error_handle ((-1), file, line, error, MSG_ERR_ACCEPT, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       (long) fd );
   }
-  errno = error;
-
-  if (flag_err_debug == S_TRUE)
-    {
-      char ipbuf[SH_IP_BUF];
-      char buf[SH_BUFSIZE];
-#if defined(USE_IPVX)
-      sl_strlcpy(errbuf, _("Address family: "), sizeof(errbuf));
-      sl_strlcat(errbuf, 
-		 (ss.ss_family == AF_INET6) ? _("AF_INET6") : _("AF_INET"),
-		 sizeof(errbuf));
-      getnameinfo((struct sockaddr *)&ss, my_addrlen,
-		  ipbuf, sizeof(ipbuf), NULL, 0, NI_NUMERICHOST);
-#else
-      struct sockaddr_in sa;
-      char * p;
-      memcpy(&(sa), (struct sockaddr_in*)&ss, sizeof(struct sockaddr_in));
-      p = inet_ntoa(sa.sin_addr);
-      sl_strlcpy(ipbuf, p, sizeof(ipbuf));
-      sl_strlcpy(errbuf, _("Address family: AF_INET"), sizeof(errbuf));
-#endif
-      sl_strlcpy(buf, _("Address: "), sizeof(buf));
-      sl_strlcat(buf, ipbuf, sizeof(buf));
-      sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, 0, MSG_E_SUBGEN,
-		       errbuf, _("retry_accept"));
-      sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, 0, MSG_E_SUBGEN,
-		       buf, _("retry_accept"));
-    }
-
-  sh_ipvx_save(serv_addr, ss.ss_family, (struct sockaddr *) &ss);
-
-  if (flag_err_debug == S_TRUE)
-    {
-      char ipbuf[SH_IP_BUF];
-      char ipbuf2[SH_IP_BUF];
-      char buf[SH_BUFSIZE];
-#if defined(USE_IPVX)
-      int len = (serv_addr->ss_family == AF_INET) ? 
-	sizeof(struct sockaddr_in) :
-	sizeof(struct sockaddr_in6);
-      getnameinfo(sh_ipvx_sockaddr_cast(serv_addr), len,
-		  ipbuf2, sizeof(ipbuf2), NULL, 0, NI_NUMERICHOST);
-#else
-      char * p = inet_ntoa((serv_addr->sin).sin_addr);
-      sl_strlcpy(ipbuf2, p, sizeof(ipbuf2));
-#endif
-      sh_ipvx_ntoa (ipbuf, sizeof(ipbuf), serv_addr);
-      sl_snprintf(buf, sizeof(buf), _("Address: %s / %s"),
-		  ipbuf, ipbuf2);
-      sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, 0, MSG_E_SUBGEN,
-		       buf, _("retry_accept"));
-    }
-
-  *addrlen = (int) my_addrlen;
+  errno = error;    
   SL_RETURN(val_retry, _("retry_accept"));
 }
 
-static int sh_enable_use_sub = 0;
-
-#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
-#if defined(HOST_IS_CYGWIN) || defined(__cygwin__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
-static int sh_use_sub = 0;
-#else
-static int sh_use_sub = 1;
-#endif
-#else
-static int sh_use_sub = 0;
-#endif
-
-void sh_calls_enable_sub()
-{
-  sh_enable_use_sub = 1;
-  return;
-}
-
-int sh_calls_set_sub (const char * str)
-{
-  int ret = sh_util_flagval(str, &sh_use_sub);
-
-  if ((ret == 0) && (!sh_use_sub))
-    {
-      sh_kill_sub();
-    }
-  return ret;
-}
-
-long int retry_lstat_ns(const char * file, int line, 
-			const char *file_name, struct stat *buf)
+long int retry_lstat(char * file, int line, 
+		     const char *file_name, struct stat *buf)
 {
   int error;
   long int val_retry = -1;
-  char errbuf[SH_ERRBUF_SIZE];
  
-  SL_ENTER(_("retry_lstat_ns"));
+  SL_ENTER(_("retry_lstat"));
 
   do {
     val_retry = /*@-unrecog@*/lstat (file_name, buf)/*@+unrecog@*/;
   } while (val_retry < 0 && errno == EINTR);
-
   error = errno;
   if (val_retry < 0) {
-      (void) sh_error_message(error, aud_err_message, 64);
+      (void) sl_strlcpy(aud_err_message, sh_error_message(error), 64);
       sh_error_handle ((-1), file, line, error, MSG_ERR_LSTAT, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       file_name );
   }
   errno = error;    
-
-  SL_RETURN(val_retry, _("retry_lstat_ns"));
-}
-
-long int retry_lstat(const char * file, int line, 
-		     const char *file_name, struct stat *buf)
+  SL_RETURN(val_retry, _("retry_lstat"));
+}
+
+long int retry_stat(char * file, int line, 
+		    const char *file_name, struct stat *buf)
 {
   int error;
   long int val_retry = -1;
-  char errbuf[SH_ERRBUF_SIZE];
- 
-  SL_ENTER(_("retry_lstat"));
-
-  if (sh_use_sub && sh_enable_use_sub)
-    {
-      val_retry = sh_sub_lstat (file_name, buf);
-    }
-  else
-    {
-      do {
-	val_retry = /*@-unrecog@*/lstat (file_name, buf)/*@+unrecog@*/;
-      } while (val_retry < 0 && errno == EINTR);
-    }
-
-  error = errno;
-  if (val_retry < 0) {
-      (void) sh_error_message(error, aud_err_message, 64);
-      sh_error_handle ((-1), file, line, error, MSG_ERR_LSTAT, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
-		       file_name );
-  }
-  errno = error;    
-
-  SL_RETURN(val_retry, _("retry_lstat"));
-}
-
-long int retry_stat(const char * file, int line, 
-		    const char *file_name, struct stat *buf)
-{
-  int error;
-  long int val_retry = -1;
-  char errbuf[SH_ERRBUF_SIZE];
  
   SL_ENTER(_("retry_stat"));
 
-  if (sh_use_sub && sh_enable_use_sub)
-    {
-      val_retry = sh_sub_stat (file_name, buf);
-    }
-  else
-    {
-      do {
-	val_retry = stat (file_name, buf);
-      } while (val_retry < 0 && errno == EINTR);
-    }
-
+  do {
+    val_retry = stat (file_name, buf);
+  } while (val_retry < 0 && errno == EINTR);
   error = errno;
   if (val_retry < 0) {
-      (void) sh_error_message(error, aud_err_message, 64);
+      (void) sl_strlcpy(aud_err_message, sh_error_message(error), 64);
       sh_error_handle ((-1), file, line, error, MSG_ERR_STAT, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       file_name );
   }
   errno = error;    
-
   SL_RETURN(val_retry, _("retry_stat"));
 }
 
-long int retry_fstat(const char * file, int line, int filed, struct stat *buf)
+long int retry_fstat(char * file, int line, int filed, struct stat *buf)
 {
   int error;
   long int val_retry = -1;
-  char errbuf[SH_ERRBUF_SIZE];
  
   SL_ENTER(_("retry_fstat"));
@@ -448,5 +281,5 @@
   if (val_retry < 0) {
       sh_error_handle ((-1), file, line, error, MSG_ERR_FSTAT, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       (long) filed );
   }
@@ -455,9 +288,8 @@
 }
 
-long int retry_fcntl(const char * file, int line, int fd, int cmd, long arg)
+long int retry_fcntl(char * file, int line, int fd, int cmd, long arg)
 {
   int error;
   long int val_retry = -1;
-  char errbuf[SH_ERRBUF_SIZE];
   errno              = 0;
 
@@ -479,5 +311,5 @@
   if (val_retry < 0) {
       sh_error_handle ((-1), file, line, error, MSG_ERR_FCNTL, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       (long) fd, (long) cmd, arg );
   }
@@ -492,4 +324,6 @@
   struct timespec req, rem;
 #endif
+
+  SL_ENTER(_("retry_fcntl"));
 
   errno  = 0;
@@ -512,16 +346,23 @@
 #else
   if (sec > 0)
-    sleep (sec); /* nanosleep not available */
-  else {
+    {
+      sleep (sec);
+    }
+  else
+    {
 #ifdef HAVE_USLEEP
-    if (millisec > 0)
-      usleep(1000 * millisec);
+      if (millisec > 0)
+	{
+	  usleep(1000 * millisec);
+	}
 #else
-    if (millisec > 0)
-      sleep (1);
+      if (millisec > 0)
+	{
+	  sleep (1);
+	}
 #endif
-  }
+    }
 #endif
-  return result;
+  SL_RETURN(result, _("retry_msleep"));
 }
 
@@ -532,7 +373,7 @@
  ***************************************************/
 
-long int retry_aud_execve  (const char * file, int line, 
-			    const  char *dateiname, char *const argv[],
-			    char *const envp[])
+long int retry_aud_execve  (char * file, int line, 
+			    const  char *dateiname, char * argv[],
+			    char * envp[])
 {
   uid_t a = geteuid();
@@ -540,5 +381,4 @@
   int   i;
   int   error;
-  char errbuf[SH_ERRBUF_SIZE];
 
   SL_ENTER(_("retry_aud_execve"));
@@ -553,6 +393,5 @@
   error = errno;
   if (i < 0) {
-      sh_error_handle ((-1), file, line, error, MSG_ERR_EXEC, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+      sh_error_handle ((-1), file, line, error, MSG_ERR_EXEC, sh_error_message(error),
 		       dateiname, (long) a, (long) b );
   }
@@ -562,10 +401,9 @@
 
 
-long int retry_aud_utime (const char * file, int line, 
-			  char * path, struct utimbuf *buf)
+long int retry_aud_utime (char * file, int line, 
+			   char * path, struct utimbuf *buf)
 {
   long int val_return;
   int  error;
-  char errbuf[SH_ERRBUF_SIZE];
   errno      = 0;
 
@@ -584,5 +422,5 @@
   if (val_return < 0) {
       sh_error_handle ((-1), file, line, error, MSG_ERR_UTIME, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       path, 
 		       (unsigned long) buf->actime, 
@@ -593,10 +431,9 @@
 }
 
-long int retry_aud_unlink (const char * file, int line, 
+long int retry_aud_unlink (char * file, int line, 
 			   char * path)
 {
   long int val_return;
   int error;
-  char errbuf[SH_ERRBUF_SIZE];
   errno      = 0;
 
@@ -612,6 +449,5 @@
 		     path);
   if (val_return < 0) {
-      sh_error_handle ((-1), file, line, error, MSG_ERR_UNLINK, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+      sh_error_handle ((-1), file, line, error, MSG_ERR_UNLINK, sh_error_message(error),
 		       path);
   }
@@ -620,10 +456,9 @@
 }
 
-long int retry_aud_dup2 (const char * file, int line, 
+long int retry_aud_dup2 (char * file, int line, 
 			 int fd, int fd2)
 {
   long int val_return;
   int error;
-  char errbuf[SH_ERRBUF_SIZE];
   errno      = 0;
 
@@ -640,5 +475,5 @@
   if (val_return < 0) {
       sh_error_handle ((-1), file, line, error, MSG_ERR_DUP, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       (long) fd, val_return);
   }
@@ -647,10 +482,9 @@
 }
 
-long int retry_aud_dup (const char * file, int line, 
+long int retry_aud_dup (char * file, int line, 
 			int fd)
 {
   long int val_return;
   int error;
-  char errbuf[SH_ERRBUF_SIZE];
   errno      = 0;
 
@@ -666,5 +500,5 @@
   if (val_return < 0) {
       sh_error_handle ((-1), file, line, error, MSG_ERR_DUP, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       (long) fd, val_return);
   }
@@ -675,10 +509,9 @@
 
   
-long int retry_aud_chdir (const char * file, int line, 
+long int retry_aud_chdir (char * file, int line, 
 			  const char *path)
 {
   long int val_return;
   int      error      = 0;
-  char errbuf[SH_ERRBUF_SIZE];
   errno      = 0;
 
@@ -694,6 +527,5 @@
 		     path);
   if (val_return < 0) {
-      sh_error_handle ((-1), file, line, error, MSG_ERR_CHDIR, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+      sh_error_handle ((-1), file, line, error, MSG_ERR_CHDIR, sh_error_message(error),
 		       path);
   }
@@ -703,5 +535,5 @@
 
 
-long int aud_open_noatime (const char * file, int line, int privs,
+long int aud_open_noatime (char * file, int line, int privs,
 			   const char *pathname, int flags, mode_t mode,
 			   int * o_noatime)
@@ -709,41 +541,22 @@
   long int val_return;
   int error;
-  char errbuf[SH_ERRBUF_SIZE];
 
   SL_ENTER(_("aud_open"));
 
-#ifdef USE_SUID
-  if (0 == strcmp(pathname, "/usr/bin/sudo"))
-    {
-      uid_t ruid; uid_t euid; uid_t suid;
-      getresuid(&ruid, &euid, &suid);
-    }
-  if (privs == SL_YESPRIV)
-    sl_set_suid();
-#else
+  val_return = open (pathname, *o_noatime|flags, mode);
+  if ((val_return < 0) && (*o_noatime != 0))
+    {
+      val_return = open (pathname, flags, mode);
+      if (val_return >= 0)
+	*o_noatime = 0;
+    }
+  error = errno;
   /*@-noeffect@*/
   (void) privs; /* fix compiler warning */
   /*@+noeffect@*/
-#endif
-
-  val_return = open (pathname, *o_noatime|flags, mode);
-
-#ifdef USE_SUID
-  if (privs == SL_YESPRIV)
-    sl_unset_suid();
-#endif
-
-  if ((val_return < 0) && (*o_noatime != 0))
-    {
-      /* cppcheck-suppress resourceLeak */
-      val_return = open (pathname, flags, mode);
-      if (val_return >= 0)
-	*o_noatime = 0;
-    }
-  error = errno;
 
   if (val_return < 0)
     {
-      (void) sh_error_message(error, aud_err_message, 64);
+      (void) sl_strlcpy(aud_err_message, sh_error_message(error), 64);
     }
 
@@ -755,5 +568,5 @@
   if (val_return < 0) {
     sh_error_handle ((-1), file, line, error, MSG_ERR_OPEN, 
-		     sh_error_message(error, errbuf, sizeof(errbuf)),
+		     sh_error_message(error),
 		     pathname, (long) flags, (long) mode, val_return);
   }
@@ -762,34 +575,21 @@
 }
 
-long int aud_open (const char * file, int line, int privs,
+long int aud_open (char * file, int line, int privs,
 		   const char *pathname, int flags, mode_t mode)
 {
   long int val_return;
   int error;
-  char errbuf[SH_ERRBUF_SIZE];
 
   SL_ENTER(_("aud_open"));
 
-#ifdef USE_SUID
-  if (privs == SL_YESPRIV)
-    sl_set_suid();
-#else
+  val_return = open (pathname, flags, mode);
+  error = errno;
   /*@-noeffect@*/
   (void) privs; /* fix compiler warning */
   /*@+noeffect@*/
-#endif
-
-  val_return = open (pathname, flags, mode);
-
-#ifdef USE_SUID
-  if (privs == SL_YESPRIV)
-    sl_unset_suid();
-#endif
-
-  error = errno;
 
   if (val_return < 0)
     {
-      (void) sh_error_message(error, aud_err_message, 64);
+      (void) sl_strlcpy(aud_err_message, sh_error_message(error), 64);
     }
 
@@ -801,5 +601,5 @@
   if (val_return < 0) {
     sh_error_handle ((-1), file, line, error, MSG_ERR_OPEN, 
-		     sh_error_message(error, errbuf, sizeof(errbuf)),
+		     sh_error_message(error),
 		     pathname, (long) flags, (long) mode, val_return);
   }
@@ -808,9 +608,8 @@
 }
   
-long int aud_kill (const char * file, int line, pid_t pid, int sig)
+long int aud_kill (char * file, int line, pid_t pid, int sig)
 {
   int  myerror;
   long int val_return = kill (pid, sig);
-  char errbuf[SH_ERRBUF_SIZE];
   myerror = errno;
 
@@ -822,5 +621,5 @@
   if (val_return < 0) {
       sh_error_handle ((-1), file, line, myerror, MSG_ERR_KILL, 
-		       sh_error_message(myerror, errbuf, sizeof(errbuf)),
+		       sh_error_message(myerror),
 		       (long) pid, (long) sig);
   }
@@ -830,34 +629,33 @@
   
 /*@noreturn@*/
-void aud_exit (const char * file, int line, int exitval)
+void aud_exit (char * file, int line, int fd)
 {
   if (sh.flag.audit != 0 && (sh.flag.aud_mask & AUD_EXIT) != 0)
     sh_error_handle ((-1), file, line, 0, MSG_AUD_EXIT,
-		      (long) exitval);
+		      (long) fd);
 
   SL_ENTER(_("aud_exit"));
 
-  sh.flag.exit = exitval;
-  exit(exitval);
+  sh.flag.exit = fd;
+  exit(fd);
 }
 
 /*@noreturn@*/
-void aud__exit (const char * file, int line, int exitval)
+void aud__exit (char * file, int line, int fd)
 {
   if (sh.flag.audit != 0 && (sh.flag.aud_mask & AUD_EXIT) != 0)
     sh_error_handle ((-1), file, line, 0, MSG_AUD_EXIT,
-		      (long) exitval);
+		      (long) fd);
 
   SL_ENTER(_("aud__exit"));
 
-  sh.flag.exit = exitval;
-  _exit(exitval);
-}
-
-pid_t aud_fork (const char * file, int line)
+  sh.flag.exit = fd;
+  _exit(fd);
+}
+
+pid_t aud_fork (char * file, int line)
 {
   int error;
   pid_t i = fork();
-  char errbuf[SH_ERRBUF_SIZE];
 
   error = errno;
@@ -869,5 +667,5 @@
   if (i == (pid_t) -1) {
     sh_error_handle ((-1), file, line, error, MSG_ERR_FORK, 
-		     sh_error_message(error, errbuf, sizeof(errbuf)),
+		     sh_error_message(error),
 		     (long) i);
   }
@@ -876,9 +674,8 @@
 }
 
-int aud_setuid (const char * file, int line, uid_t uid)
+int aud_setuid (char * file, int line, uid_t uid)
 {
   int error = 0;
   int i = 0;
-  char errbuf[SH_ERRBUF_SIZE];
 
   SL_ENTER(_("aud_setuid"));
@@ -897,5 +694,5 @@
   if (i < 0) {
     sh_error_handle ((-1), file, line, error, MSG_ERR_SETUID, 
-		     sh_error_message(error, errbuf, sizeof(errbuf)),
+		     sh_error_message(error),
 		     (long) uid);
   }
@@ -904,9 +701,8 @@
 }
 
-int aud_setgid (const char * file, int line, gid_t gid)
+int aud_setgid (char * file, int line, gid_t gid)
 {
   int error = 0;
   int i = 0;
-  char errbuf[SH_ERRBUF_SIZE];
 
   SL_ENTER(_("aud_setgid"));
@@ -926,5 +722,5 @@
   if (i < 0) {
     sh_error_handle ((-1), file, line, error, MSG_ERR_SETGID, 
-		     sh_error_message(error, errbuf, sizeof(errbuf)),
+		     sh_error_message(error),
 		     (long) gid);
   }
@@ -933,9 +729,8 @@
 }
 
-int aud_pipe (const char * file, int line, int modus[2])
+int aud_pipe (char * file, int line, int * modus)
 {
   int error;
   int i = pipe (modus);
-  char errbuf[SH_ERRBUF_SIZE];
 
   SL_ENTER(_("aud_pipe"));
@@ -954,9 +749,9 @@
     if (i < 0)
       sh_error_handle ((-1), file, line, error, MSG_ERR_PIPE, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       (long) 0, (long) 0);
     else
       sh_error_handle ((-1), file, line, error, MSG_ERR_PIPE, 
-		       sh_error_message(error, errbuf, sizeof(errbuf)),
+		       sh_error_message(error),
 		       (long) modus[0], (long) modus[1]);
   }
