From: Mark Wooding Date: Sun, 24 Apr 2016 22:30:30 +0000 (+0100) Subject: with-authinfo-kludge (accept_loop): Fix `select' error handling. X-Git-Tag: 0.1.0~9 X-Git-Url: https://git.distorted.org.uk/~mdw/with-authinfo-kludge/commitdiff_plain/9b7b093fd18e648205eab3c717c7b0de3664a71a with-authinfo-kludge (accept_loop): Fix `select' error handling. We shouldn't go through the file descriptors if select(2) failed: the table is likely to be bobbins. --- diff --git a/with-authinfo-kludge b/with-authinfo-kludge index 91785cc..2ba8969 100755 --- a/with-authinfo-kludge +++ b/with-authinfo-kludge @@ -766,9 +766,11 @@ sub run_client (@) { sub accept_loop () { my $rfd_in = ""; for my $fd (keys %SERVMAP) { vec($rfd_in, $fd, 1) = 1; } - for (;;) { + SELECT: for (;;) { my ($n, $t) = select my $rfd_out = $rfd_in, undef, undef, undef; - $n >= 0 || $! == EINTR or sysfail "select failed: $!"; + if ($n >= 0) { } + elsif ($! == EINTR) { next SELECT; } + else { sysfail "select failed: $!"; } FD: for my $fd (keys %SERVMAP) { next unless vec $rfd_out, $fd, 1; my ($s, $a, $sk) = @{$SERVMAP{$fd}};