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;