summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-04-01 16:45:35 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-04-01 16:54:28 +0200
commit4d4f065e37fca873aa27a55a293ad0e13136d92e (patch)
tree1baed151ae6ea07eae8a1ca960aadbc3ea115635 /src
parent2725780520d0e2c6a2c49ac8e2124b5088cbe1bb (diff)
downloadouroboros-4d4f065e37fca873aa27a55a293ad0e13136d92e.tar.gz
ouroboros-4d4f065e37fca873aa27a55a293ad0e13136d92e.zip
tools: oping: Fix bad calculation
This fixes a potential overflow when calculating the packet loss.
Diffstat (limited to 'src')
-rw-r--r--src/tools/oping/oping_client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c
index 77a08db7..43f402a2 100644
--- a/src/tools/oping/oping_client.c
+++ b/src/tools/oping/oping_client.c
@@ -234,7 +234,7 @@ int client_main(void)
printf("%d SDUs transmitted, ", client.sent);
printf("%d received, ", client.rcvd);
printf("%d%% packet loss, ", client.sent == 0 ? 0 :
- 100 - ((100 * client.rcvd) / client.sent));
+ 100 - (100 * (client.rcvd / client.sent)));
printf("time: %.3f ms\n", ts_diff_us(&tic, &toc) / 1000.0);
if (client.rcvd > 0) {