]> andersk Git - moira.git/commitdiff
syslog instead of spewing to stdout.
authorzacheiss <zacheiss>
Mon, 8 May 2000 18:28:59 +0000 (18:28 +0000)
committerzacheiss <zacheiss>
Mon, 8 May 2000 18:28:59 +0000 (18:28 +0000)
update/update_server.c

index a0832e6b2c13ee0b125f8ecb8cc1591f199e833c..af0cc526c66d32f6d86200e5228c8e4841f79504 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <syslog.h>
 
 #include <des.h>
 #include "update.h"
@@ -36,6 +37,8 @@ des_cblock session;
 int uid = 0;
 
 void child_handler(int signal);
+static void syslog_com_err_proc(const char *progname, long code,
+                               const char *fmt, va_list args);
 
 struct _dt {
   char *str;
@@ -117,6 +120,9 @@ int main(int argc, char **argv)
       exit(1);
     }
 
+  set_com_err_hook(syslog_com_err_proc);
+  openlog(whoami, LOG_PID, LOG_DAEMON);
+
   /* now loop waiting for connections */
   while (1)
     {
@@ -228,3 +234,16 @@ void child_handler(int signal)
   while (waitpid(-1, &status, WNOHANG) > 0)
     ;
 }
+
+static void syslog_com_err_proc(const char *progname, long code,
+                               const char *fmt, va_list args)
+{
+  char *buf;
+  int bufsiz = 1024;
+
+  buf = malloc(bufsiz + 1);
+  buf[bufsiz] = '\0';
+
+  vsnprintf(buf, bufsiz, fmt, args);
+  syslog(LOG_NOTICE, buf);
+}
This page took 0.067912 seconds and 5 git commands to generate.