return r;
}
+static int pakfire_pty_disable_echo(struct pakfire_pty* self, int fd) {
+ struct termios t = {};
+ int r;
+
+ // Fetch current attributes
+ r = tcgetattr(fd, &t);
+ if (r < 0) {
+ ERROR(self->ctx, "Failed to fetch terminal attributes from %d: %m\n", fd);
+ return -errno;
+ }
+
+ // Disable echo
+ t.c_lflag &= ~ECHO;
+
+ // Restore the changed attributes
+ r = tcsetattr(fd, TCSANOW, &t);
+ if (r < 0) {
+ ERROR(self->ctx, "Failed to restore terminal attributes to %d: %m\n", fd);
+ return -errno;
+ }
+
+ return 0;
+}
+
/*
Sets up the terminal in the child process...
*/
DEBUG(pty->ctx, "Opened a new terminal %d\n", fd);
+ // Disable echo
+ if (pty->stdin.callbacks.stdin_callback) {
+ r = pakfire_pty_disable_echo(pty, fd);
+ if (r < 0)
+ goto ERROR;
+ }
+
// Connect the new terminal to standard input
if (pty->stdin.io & PAKFIRE_PTY_CONNECT) {
r = dup2(fd, STDIN_FILENO);