From ef7aed48e056b58d106be2640b591d8022f86bfb Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Fri, 29 Oct 2021 11:49:11 +0200 Subject: www-misc/slowcgi: Bump to 7.0 Package-Manager: Portage-3.0.28, Repoman-3.0.3 --- .../7.0-Add-flag-to-run-in-the-foreground.patch | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 www-misc/slowcgi/files/7.0-Add-flag-to-run-in-the-foreground.patch (limited to 'www-misc/slowcgi/files/7.0-Add-flag-to-run-in-the-foreground.patch') diff --git a/www-misc/slowcgi/files/7.0-Add-flag-to-run-in-the-foreground.patch b/www-misc/slowcgi/files/7.0-Add-flag-to-run-in-the-foreground.patch new file mode 100644 index 0000000..69e31bf --- /dev/null +++ b/www-misc/slowcgi/files/7.0-Add-flag-to-run-in-the-foreground.patch @@ -0,0 +1,97 @@ +From baed2c0935ca606d6d55d70b07db0cec7322f10c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Wolfgang=20M=C3=BCller?= +Date: Fri, 29 Oct 2021 11:45:32 +0200 +Subject: [PATCH] Add flag to run in the foreground + +slowcgi already has the -d flag to disable forking, but that particular +flag also stops slowcgi from logging to syslog and is intended for +debugging purposes. + +Ordinarily this would be fine, but sadly we know of no clean way to +track the PID of a forked process with Gentoo's OpenRC and its +start-stop-daemon(8). We could add support to write a pidfile instead, +but since we want to support multiple invocations of slowcgi through +OpenRC and ${RC_SVCNAME}, we need a way of specifying the pidfile +location in the init script itself. + +To solve this reasonably cleanly, add a flag that *only* controls +whether or not the program daemonizes or not. Make sure to mention this +in the manual too. +--- + slowcgi.8 | 6 +++++- + slowcgi.c | 10 +++++++--- + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/slowcgi.8 b/slowcgi.8 +index cfc4dee..bdfc0b7 100644 +--- a/slowcgi.8 ++++ b/slowcgi.8 +@@ -22,7 +22,7 @@ + .Nd a FastCGI to CGI wrapper server + .Sh SYNOPSIS + .Nm +-.Op Fl dv ++.Op Fl dfv + .Op Fl p Ar path + .Op Fl s Ar socket + .Op Fl U Ar user +@@ -64,6 +64,10 @@ Do not daemonize. + If this option is specified, + .Nm + will run in the foreground and log to stderr. ++.It Fl f ++As ++.Fl d , ++but log to syslog. + .It Fl p Ar path + .Xr chroot 2 + to +diff --git a/slowcgi.c b/slowcgi.c +index 9999ac8..96662e0 100644 +--- a/slowcgi.c ++++ b/slowcgi.c +@@ -269,7 +269,7 @@ usage(void) + { + extern char *__progname; + fprintf(stderr, +- "usage: %s [-dv] [-p path] [-s socket] [-U user] [-u user]\n", ++ "usage: %s [-dfv] [-p path] [-s socket] [-U user] [-u user]\n", + __progname); + exit(1); + } +@@ -277,6 +277,7 @@ usage(void) + struct timeval timeout = { TIMEOUT_DEFAULT, 0 }; + struct slowcgi_proc slowcgi_proc; + int debug = 0; ++int foreground = 0; + int verbose = 0; + int on = 1; + char *fcgi_socket = "/var/www/run/slowcgi.sock"; +@@ -310,11 +311,14 @@ main(int argc, char *argv[]) + } + } + +- while ((c = getopt(argc, argv, "dp:s:U:u:v")) != -1) { ++ while ((c = getopt(argc, argv, "dfp:s:U:u:v")) != -1) { + switch (c) { + case 'd': + debug++; + break; ++ case 'f': ++ foreground = 1; ++ break; + case 'p': + chrootpath = optarg; + break; +@@ -339,7 +343,7 @@ main(int argc, char *argv[]) + if (geteuid() != 0) + errx(1, "need root privileges"); + +- if (!debug && daemon(0, 0) == -1) ++ if (!debug && !foreground && daemon(0, 0) == -1) + err(1, "daemon"); + + if (!debug) { +-- +2.33.1 + -- cgit v1.2.3-2-gb3c3