X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fpatplex.c;h=a0818d2bd68cee1d5951f9385167738656745b19;hb=f9a65eb249034b28f604dce099deb1a622d373cf;hp=55063866e80b652ab6fc65dff905d0aff3df0122;hpb=8cc893f5a55ad27a6971524b41e99589576eade5;p=ashd.git diff --git a/src/patplex.c b/src/patplex.c index 5506386..a0818d2 100644 --- a/src/patplex.c +++ b/src/patplex.c @@ -491,10 +491,12 @@ static void reloadconf(char *nm) static void chldhandler(int sig) { pid_t pid; + int st; - do { - pid = waitpid(-1, NULL, WNOHANG); - } while(pid > 0); + while((pid = waitpid(-1, &st, WNOHANG)) > 0) { + if(WCOREDUMP(st)) + flog(LOG_WARNING, "child process %i dumped core", pid); + } } static void sighandler(int sig) @@ -512,7 +514,7 @@ int main(int argc, char **argv) { int c; int nodef; - char *gcf; + char *gcf, *lcf; struct hthead *req; int fd; @@ -540,8 +542,14 @@ int main(int argc, char **argv) free(gcf); } } - if((lconfig = readconfig(argv[optind])) == NULL) { - flog(LOG_ERR, "could not read `%s'", argv[optind]); + if((strchr(lcf = argv[optind], '/')) == NULL) { + if((lcf = findstdconf(sprintf3("ashd/%s", lcf))) == NULL) { + flog(LOG_ERR, "could not find requested configuration file `%s'", argv[optind]); + exit(1); + } + } + if((lconfig = readconfig(lcf)) == NULL) { + flog(LOG_ERR, "could not read `%s'", lcf); exit(1); } signal(SIGCHLD, chldhandler); @@ -549,7 +557,7 @@ int main(int argc, char **argv) signal(SIGPIPE, sighandler); while(1) { if(reload) { - reloadconf(argv[optind]); + reloadconf(lcf); reload = 0; } if((fd = recvreq(0, &req)) < 0) {