INN commit: trunk/frontends (cnfsstat.in)

INN Commit rra at isc.org
Fri Oct 29 18:30:02 UTC 2010


    Date: Friday, October 29, 2010 @ 11:30:02
  Author: iulius
Revision: 9141

When "cnfsstat -a" is used, a Perl warning occurs if the CNFS buffer has
not been initialized yet or received an article.  The time of the oldest
article is unset.  We now properly take it into account.

Thanks to Florian Schlichting for the bug report.

Modified:
  trunk/frontends/cnfsstat.in

-------------+
 cnfsstat.in |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Modified: cnfsstat.in
===================================================================
--- cnfsstat.in	2010-10-29 18:24:47 UTC (rev 9140)
+++ cnfsstat.in	2010-10-29 18:30:02 UTC (rev 9141)
@@ -290,12 +290,23 @@
     print " Buffer $name, size: ", &human_readable($len, 4);
     print ", position: ", &human_readable($free, 4);
     printf("  %.2f cycles\n", $cyclenum + Math::BigFloat->new($free) / Math::BigFloat->new($len));
+
+    # The CNFS buffer may not have been initialized yet or received an article.
+    # Take it into account because $oldart may be undefined.
     my ($when, $ago) = &make_time($update);
-    print "  Newest: $when, $ago ago\n";
+    if (defined $oldart || not $opt_a) {
+        print "  Newest: $when, $ago ago\n";
+    } else {
+        print "  Created: $when, $ago ago\n";
+    }
 
     if ($opt_a) {
-	my ($when, $ago) = &make_time($oldart);
-	print "  Oldest: $when, $ago ago\n";
+        if (defined $oldart) {
+            my ($when, $ago) = &make_time($oldart);
+            print "  Oldest: $when, $ago ago\n";
+        } else {
+            print "  No oldest article\n";
+        }
     }
 }
 




More information about the inn-committers mailing list