summaryrefslogtreecommitdiffstats
path: root/qarsh.c
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2013-09-19 10:10:16 -0400
committerNathan Straz <nstraz@redhat.com>2013-09-19 10:26:32 -0400
commit8bc29add2abf434390b3e6696ff7b364d658f028 (patch)
treefaa927113db114a7d1ed4c03f9196def61692a95 /qarsh.c
parent486049502c9156e1309a81651f014f2d4fd4450e (diff)
downloadqarsh-8bc29add2abf434390b3e6696ff7b364d658f028.tar.gz
qarsh-8bc29add2abf434390b3e6696ff7b364d658f028.tar.xz
qarsh-8bc29add2abf434390b3e6696ff7b364d658f028.zip
Creat a thin logging layer
When qarshd is run via xinetd, stderr still goes out the socket and messages from sockutil.c or qarsh_packet.c can interfere with the protocol. Create a thin wrapper which qacp and qarsh can send to stderr and qarshd can send to syslog.
Diffstat (limited to 'qarsh.c')
-rw-r--r--qarsh.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/qarsh.c b/qarsh.c
index 49210db..51a876b 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -35,9 +35,9 @@
#include <sys/select.h>
#include <netinet/in.h>
#include <netdb.h>
-#include <syslog.h>
#include <pwd.h>
#include <time.h>
+#include <stdarg.h>
#include "sockutil.h"
#include "qarsh_packet.h"
@@ -58,6 +58,17 @@ int sigs_to_propogate[] = { SIGINT, SIGTERM, SIGHUP, SIGUSR1, SIGUSR2 };
sigset_t pselect_sigmask;
int connection_timeout = 0;
+
+void
+lprintf(int priority, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+}
+
void
usage()
{
@@ -430,8 +441,6 @@ main(int argc, char *argv[])
char *cp;
int max_timeout = 120;
- openlog("qarsh", LOG_PID, LOG_DAEMON);
-
if ((cp = getenv("QARSH_TIMEOUT")) != NULL) {
max_timeout = atoi(cp);
}