diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2015-06-10 09:38:38 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-06-10 09:43:51 +0200 |
commit | 03f6d2aaec860d89e3d6280fa31dd03ed6a8f435 (patch) | |
tree | f78cfa4db944971f66e668caa6dc0c15d44825eb /call/call.c | |
parent | f079af0c0f59f00c79808cca931425e848d43efa (diff) |
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 <ralf@linux-mips.org>
Diffstat (limited to 'call/call.c')
-rw-r--r-- | call/call.c | 13 |
1 files changed, 8 insertions, 5 deletions
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)) { |