p->error_condition = STUB_ERROR_PIPE;
p->pipe_params.error_condition = STUB_ERROR_PIPE;
static int readfromchild(struct pipe_params *p){	size_t bytestoread;	ssize_t r;	bytestoread = p->script_input.ceiling - p->script_input.end;	if (p->haslen && bytestoread > p->pmax)		bytestoread = p->pmax;	if (bytestoread == 0) {		log_d("readfromchild: bytestoread is zero!");		return 0;	}	r = recv(p->pfd, p->script_input.end, bytestoread, 0);	if (debug)		log_d("readfromchild: %d %d %d %d", p->pfd, p->script_input.end - p->script_input.floor, bytestoread, r);	switch (r) {	case -1:		if (errno == EAGAIN)			return 0;		lerror("readfromchild");		p->error_condition = STUB_ERROR_PIPE;		return -1;	case 0:		if (p->state != 2) {			log_d("readfromchild: premature end of script headers (ipp=%d)", p->script_input.end - p->script_input.floor);			p->error_condition = STUB_ERROR_RESTART;			return -1;		}		if (p->haslen) {			log_d("readfromchild: script went away (pmax=%d)", p->pmax);			p->error_condition = STUB_ERROR_PIPE;			return -1;		}		p->t = current_time;		p->script_input.state = 2;		break;	default:		p->t = current_time;		p->script_input.end += r;		if (p->haslen) {			p->pmax -= r;			if (p->pmax == 0)				p->script_input.state = 2;		}		break;	}	return 0;}