diff options
Diffstat (limited to 'src/libthread/daemonize.c')
| -rw-r--r-- | src/libthread/daemonize.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libthread/daemonize.c b/src/libthread/daemonize.c index 3c408825..da8ec977 100644 --- a/src/libthread/daemonize.c +++ b/src/libthread/daemonize.c @@ -1,3 +1,6 @@ +#include <u.h> +#include <sys/time.h> +#include <sys/resource.h> #include "threadimpl.h" #undef waitpid @@ -11,6 +14,7 @@ static void child(void) { int status, pid; + struct rlimit rl; notedisable("sys: child"); pid = waitpid(sigpid, &status, 0); @@ -21,6 +25,14 @@ child(void) if(WIFEXITED(status)) _exit(WEXITSTATUS(status)); if(WIFSIGNALED(status)){ + /* + * Make sure we don't scribble over the nice + * core file that our child just wrote out. + */ + rl.rlim_cur = 0; + rl.rlim_max = 0; + setrlimit(RLIMIT_CORE, &rl); + signal(WTERMSIG(status), SIG_DFL); raise(WTERMSIG(status)); _exit(98); /* not reached */ |
