X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=blobdiff_plain;f=process.c;h=d9d01cec2c1abc090e8c4911482c071664f3d514;hp=b40801b17a593fc5ce5875687c64220af6eab0b9;hb=042a8da9053c205ea74ec1785c93ca4bcf4ea5e0;hpb=7138d0c54cd2212439434d27cb2d6ea775c3039b diff --git a/process.c b/process.c index b40801b..d9d01ce 100644 --- a/process.c +++ b/process.c @@ -39,11 +39,10 @@ static void set_default_signals(void); signal processing so that we can catch SIGCHLD for them and report their exit status using the callback function. We block SIGCHLD until signal processing has begun. */ -extern void makesubproc(process_entry_fn *entry, process_callback_fn *cb, - void *est, void *cst, string_t desc) +pid_t makesubproc(process_entry_fn *entry, process_callback_fn *cb, + void *est, void *cst, string_t desc) { struct child *c; - sigset_t sigchld; pid_t p; c=safe_malloc(sizeof(*c),"makesubproc"); @@ -52,9 +51,7 @@ extern void makesubproc(process_entry_fn *entry, process_callback_fn *cb, c->cst=cst; if (!signal_handling) { - sigemptyset(&sigchld); - sigaddset(&sigchld,SIGCHLD); - sigprocmask(SIG_BLOCK,&sigchld,NULL); + fatal("makesubproc called before signal handling started\n"); } p=fork(); if (p==0) { @@ -70,6 +67,7 @@ extern void makesubproc(process_entry_fn *entry, process_callback_fn *cb, c->finished=False; c->next=children; children=c; + return p; } static signal_notify_fn sigchld_handler;