]> git.pond.sub.org Git - empserver/commitdiff
Fix client to abort script execution on SIGINT
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 11 Apr 2009 20:52:52 +0000 (22:52 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 11 Apr 2009 20:52:52 +0000 (22:52 +0200)
src/client/play.c

index da43e609d1b35d5a8ea9d9768301721b54b17c26..6d74382e3eb25f3224fef5893cdd33903f1b1b02 100644 (file)
@@ -489,8 +489,14 @@ play(int sock)
            && ring_putm(&inbuf, EOF_COOKIE, sizeof(EOF_COOKIE) - 1) >= 0)
            send_eof--;
        if (send_intr
-           && ring_putm(&inbuf, INTR_COOKIE, sizeof(INTR_COOKIE) - 1) >= 0)
+           && ring_putm(&inbuf, INTR_COOKIE, sizeof(INTR_COOKIE) - 1) >= 0) {
            send_intr = 0;
+           if (input_fd) {
+               /* execute aborted, switch back to fd 0 */
+               close(input_fd);
+               input_fd = eof_fd0 ? -1 : 0;
+           }
+       }
 
        if (n < 0)
            continue;