From 1b6eade60f47493424c66bb85149bf7cab89d2e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Wed, 18 Feb 2009 16:47:07 +0000 Subject: [PATCH] Ignore pid-file option in no-fork mode (instead of producing empty file) git-svn-id: svn://svn.lighttpd.net/spawn-fcgi/trunk@14 4a9f3682-ca7b-49a8-9a55-ba4640e46f83 --- NEWS | 1 + src/spawn-fcgi.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b238dfa..a8a1901 100644 --- a/NEWS +++ b/NEWS @@ -11,3 +11,4 @@ NEWS * Only try to connect to unix socket (not tcp) before spawning (fixes again #1575) * Only disconnect from terminal in fork mode (keep stderr/stdout open in nofork mode) * Allow numerical user and group ids for -u/-g (fixes #1141) + * Ignore pid-file option in no-fork mode (instead of producing empty file) diff --git a/src/spawn-fcgi.c b/src/spawn-fcgi.c index 36ac2c6..3193bc4 100644 --- a/src/spawn-fcgi.c +++ b/src/spawn-fcgi.c @@ -349,7 +349,7 @@ static void show_help () { " -C (PHP only) numbers of childs to spawn (default: not setting\n" \ " the PHP_FCGI_CHILDREN env var - php defaults to 0)\n" \ " -F numbers of childs to fork (default 1)\n" \ -" -P name of PID-file for spawed process\n" \ +" -P name of PID-file for spawed process (ignored in no-fork mode)\n" \ " -n no fork (for daemontools)\n" \ " -v show version\n" \ " -?, -h show this help\n" \ @@ -433,6 +433,8 @@ int main(int argc, char **argv) { return -1; } + if (nofork) pid_file = NULL; /* ignore pid file in no-fork mode */ + if (pid_file && (-1 == (pid_fd = open(pid_file, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)))) { struct stat st;