]> git.ipfire.org Git - pakfire.git/commitdiff
pty: Consider ourselves drained if the master fd is closed
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 12 Oct 2024 16:43:45 +0000 (16:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 12 Oct 2024 16:43:45 +0000 (16:43 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pty.c

index 31986fd1391ad0b9965864b7f25cddb91871216b..ff83cf05210e9526df1ba3aeb36cf4891bd445ee 100644 (file)
@@ -274,6 +274,10 @@ static int pakfire_pty_drained(struct pakfire_pty* pty) {
        if (pty->master.io & PAKFIRE_PTY_READY_TO_READ)
                return 0;
 
+       // We are drained if the file descriptor is closed
+       if (pty->master.fd < 0)
+               return 1;
+
        // Is there anything in the input buffer?
        r = ioctl(pty->master.fd, TIOCINQ, &q);
        if (r < 0) {