It is not a good idea to use zero as that might be a valid fd.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
// Close the write end of the pipe
if (*fd_write) {
close(*fd_write);
- *fd_write = 0;
+ *fd_write = -1;
}
// Return the read end
// Close the read end of the pipe
if (*fd_read) {
close(*fd_read);
- *fd_read = 0;
+ *fd_read = -1;
}
// Return the write end
int fd = fds[i];
// Skip fds which were not initialized
- if (fd <= 0)
+ if (fd < 0)
continue;
ev.events = EPOLLHUP;
.flags = flags,
.pipes = {
- .stdin = { 0, 0 },
- .stdout = { 0, 0 },
- .stderr = { 0, 0 },
+ .stdin = { -1, -1 },
+ .stdout = { -1, -1 },
+ .stderr = { -1, -1 },
},
.communicate = {
.out = communicate_out,
.data = data,
},
+
+ .pidfd = -1,
};
DEBUG(jail->pakfire, "Executing jail...\n");