for (unsigned int i = 0; i < 2; i++) {
int fd = fds[i];
- // Read flags
- int flags = fcntl(fd, F_GETFL, 0);
-
- // Set modified flags
- if (fcntl(fd, F_SETFL, flags|O_NONBLOCK) < 0) {
- ERROR(jail->pakfire,
- "Could not set file descriptor %d into non-blocking mode: %m\n", fd);
- r = 1;
- goto OUT;
- }
-
ev.data.fd = fd;
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &ev) < 0) {
// Create pipes to communicate with child process if we are not running interactively
if (!pakfire_jail_has_flag(jail, PAKFIRE_JAIL_INTERACTIVE)) {
// stdout
- r = pipe(ctx.pipes.stdout);
+ r = pipe2(ctx.pipes.stdout, O_NONBLOCK);
if (r < 0) {
ERROR(jail->pakfire, "Could not create file descriptors for stdout: %m\n");
goto ERROR;
}
// stderr
- r = pipe(ctx.pipes.stderr);
+ r = pipe2(ctx.pipes.stderr, O_NONBLOCK);
if (r < 0) {
ERROR(jail->pakfire, "Could not create file descriptors for stderr: %m\n");
goto ERROR;