diff --git a/ttynvt.c b/ttynvt.c index 774eb38..57e9b0b 100644 --- a/ttynvt.c +++ b/ttynvt.c @@ -99,9 +99,12 @@ _PRF2_ static void _log(int prio, const char *fmt, ...) #define DBG2(...) \ if (ttynvt_param.debug > 1) _log(LOG_DEBUG, __VA_ARGS__) +static volatile char _is_interrupted = 0; static void sig_handler(int sig) { + DBG("Interruped, signal = %d\n", sig); + _is_interrupted = 1; } static void set_signal_handler(void) @@ -489,7 +492,9 @@ ttynvt_read(fuse_req_t req, size_t size, off_t off, size = TMP_BUF_SIZE; fuse_req_interrupt_func(req, ttynvt_interrupted, (void *)pthread_self()); - res = read(tty->fds[FD_SLAVE].fd, tty->tmp_buf, size); + res = + _is_interrupted ? -2 : read(tty->fds[FD_SLAVE].fd, tty->tmp_buf, size); + _is_interrupted = 0; fuse_req_interrupt_func(req, NULL, NULL); if (res < 0) {