diff options
Diffstat (limited to '')
-rw-r--r-- | slowcgi.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -278,7 +278,7 @@ usage(void) { extern char *__progname; fprintf(stderr, - "usage: %s [-dv] [-p path] [-s socket] [-t timeout] [-U user] " + "usage: %s [-dfv] [-p path] [-s socket] [-t timeout] [-U user] " "[-u user]\n", __progname); exit(1); } @@ -286,6 +286,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"; @@ -320,11 +321,14 @@ main(int argc, char *argv[]) } } - while ((c = getopt(argc, argv, "dp:s:t:U:u:v")) != -1) { + while ((c = getopt(argc, argv, "dfp:s:t:U:u:v")) != -1) { switch (c) { case 'd': debug++; break; + case 'f': + foreground = 1; + break; case 'p': chrootpath = optarg; break; @@ -355,7 +359,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) { |