diff options
author | Julius Bünger <buenger@mytum.de> | 2018-06-25 01:03:38 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-06-25 01:04:25 +0200 |
commit | 379b23128b670922fe8a6da55e0b46d698d7cdcb (patch) | |
tree | 1912da9af80cb3a297b631a5593608a0b5ef7e64 /src/rps/gnunet-rps-profiler.c | |
parent | dde9853ec747407f6e408d53df8b5e533db82b29 (diff) | |
download | gnunet-379b23128b670922fe8a6da55e0b46d698d7cdcb.tar.gz gnunet-379b23128b670922fe8a6da55e0b46d698d7cdcb.zip |
rps: fixed bugs reported by coverity
Diffstat (limited to 'src/rps/gnunet-rps-profiler.c')
-rw-r--r-- | src/rps/gnunet-rps-profiler.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index b43ce2fa2..16f23e86c 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c | |||
@@ -1951,9 +1951,13 @@ static void compute_probabilities (uint32_t peer_idx) | |||
1951 | if ((GNUNET_YES == is_in_view (i, peer_idx)) && | 1951 | if ((GNUNET_YES == is_in_view (i, peer_idx)) && |
1952 | (1 <= (0.45 * view_size))) | 1952 | (1 <= (0.45 * view_size))) |
1953 | { | 1953 | { |
1954 | prob_push = 1.0 * binom (0.45 * view_size, 1) | 1954 | if (0 == binom (view_size, 0.45 * view_size)) prob_push = 0; |
1955 | / | 1955 | else |
1956 | binom (view_size, 0.45 * view_size); | 1956 | { |
1957 | prob_push = 1.0 * binom (0.45 * view_size, 1) | ||
1958 | / | ||
1959 | binom (view_size, 0.45 * view_size); | ||
1960 | } | ||
1957 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1961 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1958 | "\t\t%" PRIu32 " is in %" PRIu32 "'s view, prob: %f\n", | 1962 | "\t\t%" PRIu32 " is in %" PRIu32 "'s view, prob: %f\n", |
1959 | peer_idx, | 1963 | peer_idx, |
@@ -2318,6 +2322,7 @@ post_test_shutdown_ready_cb (void *cls, | |||
2318 | rps_peer->index); | 2322 | rps_peer->index); |
2319 | GNUNET_free (stat_cls); | 2323 | GNUNET_free (stat_cls); |
2320 | GNUNET_break (0); | 2324 | GNUNET_break (0); |
2325 | return; | ||
2321 | } | 2326 | } |
2322 | 2327 | ||
2323 | if (NULL != rps_peer->stat_op && | 2328 | if (NULL != rps_peer->stat_op && |
@@ -2494,7 +2499,6 @@ test_run (void *cls, | |||
2494 | struct OpListEntry *entry; | 2499 | struct OpListEntry *entry; |
2495 | 2500 | ||
2496 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n"); | 2501 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n"); |
2497 | printf ("test 1\n"); | ||
2498 | 2502 | ||
2499 | /* Check whether we timed out */ | 2503 | /* Check whether we timed out */ |
2500 | if (n_peers != num_peers || | 2504 | if (n_peers != num_peers || |
@@ -2578,7 +2582,6 @@ test_run (void *cls, | |||
2578 | * | 2582 | * |
2579 | * @param argc unused | 2583 | * @param argc unused |
2580 | * @param argv unused | 2584 | * @param argv unused |
2581 | * @return 0 on success | ||
2582 | */ | 2585 | */ |
2583 | static void | 2586 | static void |
2584 | run (void *cls, | 2587 | run (void *cls, |
@@ -2654,8 +2657,6 @@ run (void *cls, | |||
2654 | with the malicious portion */ | 2657 | with the malicious portion */ |
2655 | 2658 | ||
2656 | ok = 1; | 2659 | ok = 1; |
2657 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2658 | "before _run()\n"); | ||
2659 | GNUNET_TESTBED_run (NULL, | 2660 | GNUNET_TESTBED_run (NULL, |
2660 | cfg, | 2661 | cfg, |
2661 | num_peers, | 2662 | num_peers, |
@@ -2664,10 +2665,6 @@ run (void *cls, | |||
2664 | NULL, | 2665 | NULL, |
2665 | &test_run, | 2666 | &test_run, |
2666 | NULL); | 2667 | NULL); |
2667 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2668 | "after _run()\n"); | ||
2669 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2670 | "gnunet-rps-profiler returned.\n"); | ||
2671 | } | 2668 | } |
2672 | 2669 | ||
2673 | /** | 2670 | /** |