From 03f6d2aaec860d89e3d6280fa31dd03ed6a8f435 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 10 Jun 2015 09:38:38 +0200 Subject: Call: Handle select(2) returning EINTR. This may happen when call is running in curses mode, and the terminal window is resized which results in a SIGWINCH sent. Ncurses as normally configured on Linux distributions will have installed a handler. If as it is the most likely case, the select call will be interrupted by the signal, select will return EINTR and call will exit. Note that this doesn't mean it's now a good idea to resize the window. Call will still not handle the screen size change properly and the output will look ugly and missformatted. Signed-off-by: Ralf Baechle --- call/call.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'call/call.c') diff --git a/call/call.c b/call/call.c index e6adbc7..f7a7770 100644 --- a/call/call.c +++ b/call/call.c @@ -1648,12 +1648,15 @@ int cmd_call(char *call[], int mode) FD_SET(fd, &sock_write); if (select(fd + 1, &sock_read, &sock_write, NULL, (uploadfile == -1 && downloadfile == -1 && inactivity_timeout_is_set == FALSE) ? NULL : &tv) == -1) { - if (!interrupted && errno == EAGAIN) { - usleep(100000); - continue; - } - if (!interrupted) + if (!interrupted) { + if (errno == EINTR) + continue; + if (errno == EAGAIN) { + usleep(100000); + continue; + } perror("select"); + } break; } if (inactivity_timeout_is_set == TRUE && !FD_ISSET(fd, &sock_read) && !FD_ISSET(STDIN_FILENO, &sock_read)) { -- cgit v1.2.3