return fd;
ERROR:
- if (fd > 0)
+ if (fd >= 0)
close(fd);
return -1;
close(fd);
// Reset the file-descriptor so it won't be closed again later
- ctx->pipes.stdin[1] = 0;
+ ctx->pipes.stdin[1] = -1;
// Report success
r = 0;
static void pakfire_jail_close_pipe(struct pakfire_jail* jail, int fds[2]) {
for (unsigned int i = 0; i < 2; i++)
- if (fds[i])
+ if (fds[i] >= 0)
close(fds[i]);
}
}
ERROR:
- if (epollfd > 0)
+ if (epollfd >= 0)
close(epollfd);
- if (timerfd > 0)
+ if (timerfd >= 0)
close(timerfd);
- if (signalfd > 0)
+ if (signalfd >= 0)
close(signalfd);
return r;
pakfire_jail_close_pipe(jail, ctx.pipes.stdin);
pakfire_jail_close_pipe(jail, ctx.pipes.stdout);
pakfire_jail_close_pipe(jail, ctx.pipes.stderr);
- if (ctx.pidfd)
+ if (ctx.pidfd >= 0)
close(ctx.pidfd);
pakfire_jail_close_pipe(jail, ctx.pipes.log_INFO);
pakfire_jail_close_pipe(jail, ctx.pipes.log_ERROR);