From 664721b2882217fae1eb2ae506d65757a68cb007 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 2 Sep 2021 13:18:04 +0000 Subject: Stop sending debug logging to syslog (which would then drop it on the floor) all the time. Instead debug logging must be requested with the new -v flag. Problem reported and fix provided by weerd@ --- slowcgi.8 | 7 +++++-- slowcgi.c | 19 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/slowcgi.8 b/slowcgi.8 index 3d162c9..810984d 100644 --- a/slowcgi.8 +++ b/slowcgi.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: slowcgi.8,v 1.14 2018/08/13 16:54:50 florian Exp $ +.\" $OpenBSD: slowcgi.8,v 1.15 2021/09/02 13:18:04 florian Exp $ .\" .\" Copyright (c) 2013 Florian Obser .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 13 2018 $ +.Dd $Mdocdate: September 2 2021 $ .Dt SLOWCGI 8 .Os .Sh NAME @@ -27,6 +27,7 @@ .Op Fl s Ar socket .Op Fl U Ar user .Op Fl u Ar user +.Op Fl v .Sh DESCRIPTION .Nm is a server which implements the FastCGI Protocol to execute CGI scripts. @@ -90,6 +91,8 @@ instead of default user www and to the home directory of .Ar user . +.It Fl v +Enable more verbose (debug) logging. .El .Sh SEE ALSO .Xr httpd 8 diff --git a/slowcgi.c b/slowcgi.c index e26d20a..5559d05 100644 --- a/slowcgi.c +++ b/slowcgi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slowcgi.c,v 1.60 2021/04/20 07:35:42 claudio Exp $ */ +/* $OpenBSD: slowcgi.c,v 1.61 2021/09/02 13:18:04 florian Exp $ */ /* * Copyright (c) 2013 David Gwynne * Copyright (c) 2013 Florian Obser @@ -277,6 +277,7 @@ usage(void) struct timeval timeout = { TIMEOUT_DEFAULT, 0 }; struct slowcgi_proc slowcgi_proc; int debug = 0; +int verbose = 0; int on = 1; char *fcgi_socket = "/var/www/run/slowcgi.sock"; @@ -309,7 +310,7 @@ main(int argc, char *argv[]) } } - while ((c = getopt(argc, argv, "dp:s:U:u:")) != -1) { + while ((c = getopt(argc, argv, "dp:s:U:u:v")) != -1) { switch (c) { case 'd': debug++; @@ -326,6 +327,9 @@ main(int argc, char *argv[]) case 'u': slowcgi_user = optarg; break; + case 'v': + verbose++; + break; default: usage(); /* NOTREACHED */ @@ -1282,9 +1286,10 @@ syslog_info(const char *fmt, ...) void syslog_debug(const char *fmt, ...) { - va_list ap; - - va_start(ap, fmt); - vsyslog(LOG_DEBUG, fmt, ap); - va_end(ap); + if (verbose > 0) { + va_list ap; + va_start(ap, fmt); + vsyslog(LOG_DEBUG, fmt, ap); + va_end(ap); + } } -- cgit v1.2.3-2-gb3c3