Introduction
Introduction Statistics Contact Development Disclaimer Help
show error/warning on fork failure - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri…
Log
Files
Refs
Tags
README
LICENSE
---
commit 60e5e4b10104014295dd9c9867900f4c72a8cffe
parent 50fd214b77643c6291a45132706cab4bfba6db7e
Author: Hiltjo Posthuma <[email protected]>
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 <[email protected]>
Diffstat:
M handlr.c | 2 ++
M 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, cha…
_exit(1);
}
case -1:
+ perror("fork");
break;
default:
wait(NULL);
@@ -227,6 +228,7 @@ handledcgi(int sock, char *file, char *port, char *base, ch…
_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);
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.