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)
{
int c;
int nodef;
- char *gcf;
+ char *gcf, *lcf;
struct hthead *req;
int fd;
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);
signal(SIGPIPE, sighandler);
while(1) {
if(reload) {
- reloadconf(argv[optind]);
+ reloadconf(lcf);
reload = 0;
}
if((fd = recvreq(0, &req)) < 0) {