summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/IO/Select.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/IO/Select.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/IO/Select.pm27
1 files changed, 18 insertions, 9 deletions
diff --git a/Master/tlpkg/tlperl/lib/IO/Select.pm b/Master/tlpkg/tlperl/lib/IO/Select.pm
index 756a299c348..994f8966ab6 100644
--- a/Master/tlpkg/tlperl/lib/IO/Select.pm
+++ b/Master/tlpkg/tlperl/lib/IO/Select.pm
@@ -11,7 +11,7 @@ use warnings::register;
use vars qw($VERSION @ISA);
require Exporter;
-$VERSION = "1.21";
+$VERSION = "1.22";
@ISA = qw(Exporter); # This is only so we can do version checking
@@ -86,15 +86,24 @@ sub _update
$vec->[$i] = $f;
} else { # remove
if ( ! defined $fn ) { # remove if fileno undef'd
- defined($_) && $_ == $f and do { $vec->[FD_COUNT]--; $_ = undef; }
- for @{$vec}[FIRST_FD .. $#$vec];
- next;
+ $fn = 0;
+ for my $fe (@{$vec}[FIRST_FD .. $#$vec]) {
+ if (defined($fe) && $fe == $f) {
+ $vec->[FD_COUNT]--;
+ $fe = undef;
+ vec($bits, $fn, 1) = 0;
+ last;
+ }
+ ++$fn;
+ }
+ }
+ else {
+ my $i = $fn + FIRST_FD;
+ next unless defined $vec->[$i];
+ $vec->[FD_COUNT]--;
+ vec($bits, $fn, 1) = 0;
+ $vec->[$i] = undef;
}
- my $i = $fn + FIRST_FD;
- next unless defined $vec->[$i];
- $vec->[FD_COUNT]--;
- vec($bits, $fn, 1) = 0;
- $vec->[$i] = undef;
}
$count++;
}