From d4de6a0d2339ac022d510d0ce2d629dc0a954a55 Mon Sep 17 00:00:00 2001 From: Nate Straz Date: Tue, 1 Jul 2008 18:33:12 +0000 Subject: Don't print out the debug syslog messages unless you also use the -d option. For those that can't configure syslog properly while debugging other things. --- qarshd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'qarshd.c') diff --git a/qarshd.c b/qarshd.c index 8cca3b5..852d76e 100644 --- a/qarshd.c +++ b/qarshd.c @@ -44,6 +44,8 @@ * QA Remote Shell Daemon */ +int debug = 0; + /* Globals */ struct sockaddr_in peername; @@ -273,7 +275,7 @@ handle_packets(int infd) } else if (nfd > 0) { qp = recv_packet(infd); if (qp == NULL) { - syslog(LOG_DEBUG, "That's enough\n"); + if (debug) syslog(LOG_DEBUG, "That's enough\n"); break; } dump_qp(qp); @@ -355,7 +357,7 @@ handle_packets(int infd) qp_packet_type(qp->qp_type)); } } else { - syslog(LOG_DEBUG, "Nothing to do\n"); + if (debug) syslog(LOG_DEBUG, "Nothing to do\n"); } } @@ -369,8 +371,11 @@ main(int argc, char *argv[]) openlog("qarshd", LOG_PID, LOG_DAEMON); - while ((ch = getopt(argc, argv, "")) != -1) { + while ((ch = getopt(argc, argv, "d")) != -1) { switch (ch) { + case 'd': + debug = 1; + break; case '?': default: printf("unknown option '%c'\n", optopt); -- cgit