Commit 6ca56e8f authored by Peter Pentchev's avatar Peter Pentchev

Use a local variable for the input file stream.

parent 3c642743
......@@ -18,6 +18,7 @@ Change log for ethstats, the network traffic statistics utility
- break the output formatting out into format_line()
- use the version module
- use fewer parentheses and quotes
- use a local variable for the input file stream
1.0 (unknown)
- released into the public domain by Drew Strieb
......
......@@ -149,10 +149,10 @@ while(1) {
sub convert()
{
open IN, "/proc/net/dev" || die "Can't open ip_acct: $!\n";
<IN>; <IN>;
open my $in, '/proc/net/dev' or die "Can't open /proc/net/dev: $!\n";
<$in>; <$in>;
my (%bytesin, %bytesout);
while (my $l = <IN>) {
while (my $l = <$in>) {
chop $l;
my ($dev, $rest) = split /:/, $l;
$dev =~ s/\s//g;
......@@ -162,7 +162,7 @@ sub convert()
$bytesin{$dev} = $devarr[0]; $bytesout{$dev} = $devarr[8];
$packin{$dev} = $devarr[1]; $packout{$dev} = $devarr[9];
}
close(IN);
close($in);
$numdevs = 0;
$tpackin = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment