summaryrefslogtreecommitdiff
path: root/net-analyzer/chaosreader/files/chaosreader-0.96-divisionbyzero.patch
diff options
context:
space:
mode:
Diffstat (limited to 'net-analyzer/chaosreader/files/chaosreader-0.96-divisionbyzero.patch')
-rw-r--r--net-analyzer/chaosreader/files/chaosreader-0.96-divisionbyzero.patch18
1 files changed, 18 insertions, 0 deletions
diff --git a/net-analyzer/chaosreader/files/chaosreader-0.96-divisionbyzero.patch b/net-analyzer/chaosreader/files/chaosreader-0.96-divisionbyzero.patch
new file mode 100644
index 000000000000..584918513062
--- /dev/null
+++ b/net-analyzer/chaosreader/files/chaosreader-0.96-divisionbyzero.patch
@@ -0,0 +1,18 @@
+--- a/chaosreader 2014-06-15 21:30:11.000000000 +0200
++++ b/chaosreader 2019-02-21 18:26:00.671756895 +0100
+@@ -4275,7 +4275,14 @@
+ print REPLAY "ms($timediff1);\n";
+ }
+ $duration = 0.01 if $duration == 0; # avoid divide by 0,
+- $speed = sprintf("%.2f",$bytes / (1024 * $duration));
++ + # avoid division by zero
++ # from https://sourceforge.net/tracker/?func=detail&aid=2210488&group_id=107384&atid=647489
++ if ( $duration > 0 ) {
++ $speed = sprintf("%.2f",$bytes / (1024 * $duration));
++ }
++ else {
++ $speed = "unknown";
++ }
+ print REPLAY "print \"\n\n" .
+ "Summary: $duration2 seconds, $bytes bytes, $speed Kb/sec\\n\";";
+ close REPLAY;