Close pipefd[1] before reading from pipefd[0]

This commit is contained in:
Robert Swiecki 2015-05-27 15:41:08 +02:00
parent dcc0565338
commit b01eb30f6b

View File

@ -225,13 +225,13 @@ void subprocRunChild(struct nsjconf_t *nsjconf, int fd_in, int fd_out, int fd_er
char log_buf[4096];
close(pipefd[1]);
ssize_t sz;
while ((sz = read(pipefd[0], log_buf, sizeof(log_buf) - 1)) > 0) {
log_buf[sz] = '\0';
logDirectlyToFD(log_buf);
}
close(pipefd[0]);
close(pipefd[1]);
subprocAdd(nsjconf, pid, fd_in);