From 9b7b093fd18e648205eab3c717c7b0de3664a71a Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 24 Apr 2016 23:30:30 +0100 Subject: [PATCH] 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. --- with-authinfo-kludge | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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}}; -- 2.11.0