if (debug) log_d("child process %d created", pid);
log_d("child process %d created", pid);
int fork_request(struct request *r, int (*f)(struct request *)){	int fd, efd;	pid_t pid;	char *child_filename;	if (forked)		_exit(1);	pid = fork();	switch (pid) {	case 0:		my_pid = getpid();		forked = 1;		mysignal(SIGPIPE, SIG_DFL);		fd = r->cn->fd;		child_filename = r->c->child_filename;		if (child_filename == 0)			efd = fd;		else {			efd = open(child_filename, O_WRONLY | O_CREAT | O_APPEND, DEFAULT_FILEMODE);			if (efd == -1) {				log_d("cannot open child log %s", child_filename);				lerror("open");				efd = fd;			}		}		dup2(fd, 0);		dup2(fd, 1);		dup2(efd, 2);		fcntl(0, F_SETFL, 0);		fcntl(1, F_SETFL, 0);		if (efd == fd)			fcntl(2, F_SETFL, 0);		close(fd);		if (efd != fd)			close(efd);		_exit(f(r));		break;	case -1:		lerror("fork");		return 503;	default:		if (debug)			log_d("child process %d created", pid);		r->status_line = "---";	}	return -1;}