Skip to content

Commit

Permalink
[backend] get rid of counter variable and duplicated code
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Aug 28, 2017
1 parent 4a9c4a5 commit 5a8ad7d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/backend/bs_repserver
Original file line number Diff line number Diff line change
Expand Up @@ -749,19 +749,13 @@ sub getbinarylist {
my @bins = grep {$_ ne 'logfile' && $_ ne 'status' && $_ ne 'reason' && $_ ne 'history' && !/^\./} ls("$reporoot/$prp/$arch/$packid");
@bins = grep {!/^::import::/} @bins if $cgi->{'noimport'};
@bins = filtersources(@bins) if $cgi->{'nosource'} || -e "$reporoot/$prp/$arch/$packid/.nosourceaccess";
my $counter = 0;
for (sort @bins) {
next if %binaries && !$binaries{$_};
if ($BSStdServer::isajax) {
if ($BSStdServer::isajax || @files > 1000) {
# do not waste file descriptors
push @files, {'name' => $_, 'filename' => "$reporoot/$prp/$arch/$packid/$_"};
next;
}
if ($counter > 1000) {
# avoid fd limit
push @files, {'name' => $_, 'filename' => "$reporoot/$prp/$arch/$packid/$_"};
next;
}
$counter++;
my $fd = gensym;
next unless open($fd, '<', "$reporoot/$prp/$arch/$packid/$_");
push @files, {'name' => $_, 'filename' => $fd};
Expand Down

0 comments on commit 5a8ad7d

Please sign in to comment.