]> granicus.if.org Git - sudo/commitdiff
added BROKEN_SYSLOG support
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 12 Jul 1995 21:05:47 +0000 (21:05 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 12 Jul 1995 21:05:47 +0000 (21:05 +0000)
logging.c

index bb98aca46c12fb8efae6ad7849485c5e27e0a382..7c919b0f0ff865d873cf8aee17d2b96545c83068 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -69,6 +69,7 @@ static char rcsid[] = "$Id$";
 static void send_mail          __P((void));
 static RETSIGTYPE reapchild    __P((int));
 static int appropriate         __P((int));
+static void syslog_wrapper     __P((int, char *, char *, char *));
 
 /*
  * Globals
@@ -77,6 +78,36 @@ static char logline[MAXLOGLEN + 8];
 extern int errorlineno;
 
 
+#ifdef BROKEN_SYSLOG
+#define MAXSYSLOGTRIES         16      /* num of retries for broken syslogs */
+
+/****************************************************************
+ *
+ *  syslog_wrapper()
+ *
+ *  This function logs via syslog w/ a priority and 3 strings args.
+ *  It really shouldn't be necesary but some syslog()'s don't
+ *  guarantee that the syslog() operation will succeed!
+ */
+
+static void syslog_wrapper(pri, fmt, arg1, arg2)
+    int pri;
+    char *fmt;
+    char *arg1;
+    char *arg2;
+{
+    int i;
+
+    for (i = 0; i < MAXSYSLOGTRIES; i++)
+       if (syslog(pri, fmt, arg1, arg2) == 0)
+           break;
+}
+
+#define syslog                 syslog_wrapper
+#endif /* BROKEN_SYSLOG */
+
+
+
 /**********************************************************************
  *
  *  log_error()