]> git.ipfire.org Git - pakfire.git/commitdiff
pty: Reset file-descriptors into blocking mode again when done
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Oct 2024 14:57:44 +0000 (14:57 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Oct 2024 14:57:44 +0000 (14:57 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pty.c

index 90c76dcc0f8ba8aee09a187a8226b79980546937..67b49e1732a69aa603a2f2d1b3076bd03ada0ebf 100644 (file)
@@ -102,8 +102,8 @@ static int pakfire_pty_restore_attrs(struct pakfire_pty* pty,
        if (!isatty(stdio->fd))
                return 0;
 
-       // Restore the flags
-       r = fcntl(stdio->fd, F_SETFL, stdio->flags);
+       // Restore the flags (and make the file descriptor blocking again)
+       r = fcntl(stdio->fd, F_SETFL, stdio->flags & ~O_NONBLOCK);
        if (r < 0) {
                CTX_ERROR(pty->ctx, "Could not set flags for file descriptor %d: %s\n",
                        stdio->fd, strerror(errno));