#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <syslog.h>
#include <des.h>
#include "update.h"
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;
exit(1);
}
+ set_com_err_hook(syslog_com_err_proc);
+ openlog(whoami, LOG_PID, LOG_DAEMON);
+
/* now loop waiting for connections */
while (1)
{
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);
+}