aboutsummaryrefslogtreecommitdiffstats
path: root/www-misc/slowcgi/files
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--www-misc/slowcgi/files/6.7-Add-flag-to-run-in-the-foreground.patch70
-rw-r--r--www-misc/slowcgi/files/slowcgi.initd2
2 files changed, 71 insertions, 1 deletions
diff --git a/www-misc/slowcgi/files/6.7-Add-flag-to-run-in-the-foreground.patch b/www-misc/slowcgi/files/6.7-Add-flag-to-run-in-the-foreground.patch
new file mode 100644
index 0000000..ecf6fff
--- /dev/null
+++ b/www-misc/slowcgi/files/6.7-Add-flag-to-run-in-the-foreground.patch
@@ -0,0 +1,70 @@
+From 6771bdc5dc8a42da2787aca1f83c1b93725f204e Mon Sep 17 00:00:00 2001
+From: Wynn Wolf Arbor <wolf@oriole.systems>
+Date: Fri, 5 Jun 2020 21:14:44 +0200
+Subject: [PATCH] Add flag to run in the foreground
+
+slowcgi already has the -d flag to disable forking, but that particular
+flag also enables debug output and stops slowcgi from logging to syslog.
+
+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.
+---
+ slowcgi.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/slowcgi.c b/slowcgi.c
+index 87ae5b2..0a34c80 100644
+--- a/slowcgi.c
++++ b/slowcgi.c
+@@ -274,7 +274,7 @@ usage(void)
+ {
+ extern char *__progname;
+ fprintf(stderr,
+- "usage: %s [-d] [-p path] [-s socket] [-U user] [-u user]\n",
++ "usage: %s [-df] [-p path] [-s socket] [-U user] [-u user]\n",
+ __progname);
+ exit(1);
+ }
+@@ -282,6 +282,7 @@ usage(void)
+ struct timeval timeout = { TIMEOUT_DEFAULT, 0 };
+ struct slowcgi_proc slowcgi_proc;
+ int debug = 0;
++int foreground = 0;
+ int on = 1;
+ char *fcgi_socket = "/var/www/run/slowcgi.sock";
+
+@@ -314,11 +315,14 @@ main(int argc, char *argv[])
+ }
+ }
+
+- while ((c = getopt(argc, argv, "dp:s:U:u:")) != -1) {
++ while ((c = getopt(argc, argv, "dfp:s:U:u:")) != -1) {
+ switch (c) {
+ case 'd':
+ debug = 1;
+ break;
++ case 'f':
++ foreground = 1;
++ break;
+ case 'p':
+ chrootpath = optarg;
+ break;
+@@ -340,7 +344,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.27.0
+
diff --git a/www-misc/slowcgi/files/slowcgi.initd b/www-misc/slowcgi/files/slowcgi.initd
index 1aff8fb..b21dd71 100644
--- a/www-misc/slowcgi/files/slowcgi.initd
+++ b/www-misc/slowcgi/files/slowcgi.initd
@@ -3,6 +3,6 @@
# Distributed under the terms of the GNU General Public License v2
command="slowcgi"
-command_args="-d -p \"${SLOWCGI_CHROOT:-/}\" -s \"/run/${RC_SVCNAME}.sock\" -U slowcgi -u slowcgi"
+command_args="-f -p \"${SLOWCGI_CHROOT:-/}\" -s \"/run/${RC_SVCNAME}.sock\" -U slowcgi -u slowcgi"
command_background=yes
pidfile="/run/${RC_SVCNAME}.pid"