if (stdio->close_fd)
close(stdio->fd);
- stdio->fd = -1;
+ stdio->fd = -EBADF;
return 0;
}
// Close the PTY
if (pty->master.fd >= 0) {
close(pty->master.fd);
- pty->master.fd = 1;
+ pty->master.fd = -EBADF;
}
// Restore any changed terminal attributes
// We can close the socket now
close(pty->socket[1]);
- pty->socket[1] = -1;
+ pty->socket[1] = -EBADF;
return 0;
}
// We can close the socket now
close(pty->socket[0]);
- pty->socket[0] = -1;
+ pty->socket[0] = -EBADF;
return 0;
}
p->flags = flags;
// Initialize the master file descriptor
- p->master.fd = -1;
+ p->master.fd = -EBADF;
// Initialize standard input/output
- p->stdin.fd = -1;
- p->stdout.fd = -1;
+ p->stdin.fd = -EBADF;
+ p->stdout.fd = -EBADF;
// Create a UNIX domain socket
r = socketpair(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0, p->socket);
Sets up the terminal in the child process...
*/
static int pakfire_pty_setup_terminal(struct pakfire_pty* pty) {
- int fd = -1;
+ int fd = -EBADF;
int r;
// Open a new terminal
// We are done with the master and close it now
close(pty->master.fd);
- pty->master.fd = -1;
+ pty->master.fd = -EBADF;
// Listen to SIGWINCH
r = sd_event_add_signal(pty->loop, &pty->sigwinch_event,