summaryrefslogtreecommitdiffstats
path: root/qarshd.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 /qarshd.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 'qarshd.c')
-rw-r--r--qarshd.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/qarshd.c b/qarshd.c
index daead85..ef0fc15 100644
--- a/qarshd.c
+++ b/qarshd.c
@@ -36,6 +36,7 @@
#include <netdb.h>
#include <pwd.h>
#include <grp.h>
+#include <stdarg.h>
#include "sockutil.h"
@@ -64,6 +65,19 @@ off_t received = 0;
char *saved_path = NULL;
struct stat saved_stat;
+void
+lprintf(int priority, const char *format, ...)
+{
+ char buf[4096];
+ va_list ap;
+
+ va_start(ap, format);
+ vsnprintf(buf, 4096, format, ap);
+ va_end(ap);
+
+ syslog(priority, "%s", buf);
+}
+
int
setup_user(char *user, char *group)
{