geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit 60e5e4b10104014295dd9c9867900f4c72a8cffe
parent 50fd214b77643c6291a45132706cab4bfba6db7e
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 23 Sep 2017 13:05:07 +0200

show error/warning on fork failure

this can be useful if there are process resource constraints set also.

Signed-off-by: Christoph Lohmann <20h@r-36.net>

Diffstat:
handlr.c | 2++
main.c | 11+++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/handlr.c b/handlr.c @@ -169,6 +169,7 @@ handlecgi(int sock, char *file, char *port, char *base, char *args, _exit(1); } case -1: + perror("fork"); break; default: wait(NULL); @@ -227,6 +228,7 @@ handledcgi(int sock, char *file, char *port, char *base, char *args, _exit(1); } case -1: + perror("fork"); break; default: dup2(sock, 1); diff --git a/main.c b/main.c @@ -401,8 +401,15 @@ main(int argc, char *argv[]) } } - if(dofork && fork() != 0) - return 0; + if(dofork) { + switch(fork()) { + case -1: + perror("fork"); + return 1; + default: + return 0; + } + } if(logfile != nil) { glfd = initlogging(logfile);