aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c9
-rw-r--r--src/rps/gnunet-rps-profiler.c212
-rw-r--r--src/rps/gnunet-service-rps.c117
-rw-r--r--src/rps/rps-sampler_client.c69
-rw-r--r--src/rps/rps-test_util.c6
-rw-r--r--src/rps/rps-test_util.h5
-rw-r--r--src/rps/test_service_rps_custommap.c2
7 files changed, 182 insertions, 238 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index 0774fecea..5614f05db 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -602,17 +602,8 @@ cleanup_client (struct IdpClient *idp)
602static void 602static void
603cleanup () 603cleanup ()
604{ 604{
605 struct IdpClient *cl;
606
607 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n"); 605 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
608 606
609 while (NULL != (cl = client_list_head))
610 {
611 GNUNET_CONTAINER_DLL_remove (client_list_head,
612 client_list_tail,
613 cl);
614 cleanup_client (cl);
615 }
616 RECLAIM_TICKETS_deinit (); 607 RECLAIM_TICKETS_deinit ();
617 if (NULL != timeout_task) 608 if (NULL != timeout_task)
618 GNUNET_SCHEDULER_cancel (timeout_task); 609 GNUNET_SCHEDULER_cancel (timeout_task);
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index 392a3c18f..0ec2fec71 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -59,10 +59,10 @@ static struct GNUNET_TIME_Relative duration;
59static struct GNUNET_TIME_Relative timeout; 59static struct GNUNET_TIME_Relative timeout;
60 60
61 61
62/** 62// /**
63 * Portion of malicious peers 63// * Portion of malicious peers
64 */ 64// */
65static double portion = .1; 65// static double portion = .1;
66 66
67/** 67/**
68 * Type of malicious peer to test 68 * Type of malicious peer to test
@@ -1229,29 +1229,6 @@ post_test_op (void *cls)
1229 1229
1230 1230
1231/** 1231/**
1232 * Seed peers.
1233 */
1234static void
1235seed_peers (void *cls)
1236{
1237 struct RPSPeer *peer = cls;
1238 unsigned int amount;
1239 unsigned int i;
1240
1241 // TODO if malicious don't seed mal peers
1242 amount = round (.5 * num_peers);
1243
1244 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Seeding peers:\n");
1245 for (i = 0; i < amount; i++)
1246 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Seeding %u. peer: %s\n",
1247 i,
1248 GNUNET_i2s (&rps_peer_ids[i]));
1249
1250 GNUNET_RPS_seed_ids (peer->rps_handle, amount, rps_peer_ids);
1251}
1252
1253
1254/**
1255 * Get the id of peer i. 1232 * Get the id of peer i.
1256 */ 1233 */
1257void 1234void
@@ -1635,76 +1612,76 @@ cancel_pending_req_rep (struct RPSPeer *rps_peer)
1635* MALICIOUS 1612* MALICIOUS
1636***********************************/ 1613***********************************/
1637 1614
1638/** 1615///**
1639 * Initialise only non-mal RPSPeers 1616// * Initialise only non-mal RPSPeers
1640 */ 1617// */
1641static void 1618//static void
1642mal_init_peer (struct RPSPeer *rps_peer) 1619//mal_init_peer (struct RPSPeer *rps_peer)
1643{ 1620//{
1644 if (rps_peer->index >= round (portion * num_peers)) 1621// if (rps_peer->index >= round (portion * num_peers))
1645 rps_peer->num_ids_to_request = 1; 1622// rps_peer->num_ids_to_request = 1;
1646} 1623//}
1647 1624
1648 1625
1649/** 1626///**
1650 * @brief Set peers to (non-)malicious before execution 1627// * @brief Set peers to (non-)malicious before execution
1651 * 1628// *
1652 * Of signature #PreTest 1629// * Of signature #PreTest
1653 * 1630// *
1654 * @param rps_peer the peer to set (non-) malicious 1631// * @param rps_peer the peer to set (non-) malicious
1655 * @param h the handle to the service 1632// * @param h the handle to the service
1656 */ 1633// */
1657static void 1634//static void
1658mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h) 1635//mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
1659{ 1636//{
1660 #if ENABLE_MALICIOUS 1637// #if ENABLE_MALICIOUS
1661 uint32_t num_mal_peers; 1638// uint32_t num_mal_peers;
1662 1639//
1663 GNUNET_assert ((1 >= portion) && 1640// GNUNET_assert ((1 >= portion) &&
1664 (0 < portion)); 1641// (0 < portion));
1665 num_mal_peers = round (portion * num_peers); 1642// num_mal_peers = round (portion * num_peers);
1666 1643//
1667 if (rps_peer->index < num_mal_peers) 1644// if (rps_peer->index < num_mal_peers)
1668 { 1645// {
1669 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1646// GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1670 "%u. peer [%s] of %" PRIu32 1647// "%u. peer [%s] of %" PRIu32
1671 " malicious peers turning malicious\n", 1648// " malicious peers turning malicious\n",
1672 rps_peer->index, 1649// rps_peer->index,
1673 GNUNET_i2s (rps_peer->peer_id), 1650// GNUNET_i2s (rps_peer->peer_id),
1674 num_mal_peers); 1651// num_mal_peers);
1675 1652//
1676 GNUNET_RPS_act_malicious (h, mal_type, num_mal_peers, 1653// GNUNET_RPS_act_malicious (h, mal_type, num_mal_peers,
1677 rps_peer_ids, target_peer); 1654// rps_peer_ids, target_peer);
1678 } 1655// }
1679 #endif /* ENABLE_MALICIOUS */ 1656// #endif /* ENABLE_MALICIOUS */
1680} 1657//}
1681 1658
1682 1659
1683static void 1660// static void
1684mal_cb (struct RPSPeer *rps_peer) 1661// mal_cb (struct RPSPeer *rps_peer)
1685{ 1662// {
1686 if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test)) 1663// if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
1687 { 1664// {
1688 return; 1665// return;
1689 } 1666// }
1690 1667//
1691 #if ENABLE_MALICIOUS 1668// #if ENABLE_MALICIOUS
1692 uint32_t num_mal_peers; 1669// uint32_t num_mal_peers;
1693 1670//
1694 GNUNET_assert ((1 >= portion) && 1671// GNUNET_assert ((1 >= portion) &&
1695 (0 < portion)); 1672// (0 < portion));
1696 num_mal_peers = round (portion * num_peers); 1673// num_mal_peers = round (portion * num_peers);
1697 1674//
1698 if (rps_peer->index >= num_mal_peers) 1675// if (rps_peer->index >= num_mal_peers)
1699 { /* It's useless to ask a malicious peer about a random sample - 1676// { /* It's useless to ask a malicious peer about a random sample -
1700 it's not sampling */ 1677// it's not sampling */
1701 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply ( 1678// GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (
1702 GNUNET_TIME_UNIT_SECONDS, 2), 1679// GNUNET_TIME_UNIT_SECONDS, 2),
1703 seed_peers, rps_peer); 1680// seed_peers, rps_peer);
1704 schedule_missing_requests (rps_peer); 1681// schedule_missing_requests (rps_peer);
1705 } 1682// }
1706 #endif /* ENABLE_MALICIOUS */ 1683// #endif /* ENABLE_MALICIOUS */
1707} 1684// }
1708 1685
1709 1686
1710/*********************************** 1687/***********************************
@@ -1714,44 +1691,6 @@ mal_cb (struct RPSPeer *rps_peer)
1714static void 1691static void
1715churn (void *cls); 1692churn (void *cls);
1716 1693
1717/**
1718 * @brief Starts churn
1719 *
1720 * Has signature of #MainTest
1721 *
1722 * This is not implemented too nicely as this is called for each peer, but we
1723 * only need to call it once. (Yes we check that we only schedule the task
1724 * once.)
1725 *
1726 * @param rps_peer The peer it's called for
1727 */
1728static void
1729churn_test_cb (struct RPSPeer *rps_peer)
1730{
1731 if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
1732 {
1733 return;
1734 }
1735
1736 /* Start churn */
1737 if ((HAVE_CHURN == cur_test_run.have_churn) && (NULL == churn_task))
1738 {
1739 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1740 "Starting churn task\n");
1741 churn_task = GNUNET_SCHEDULER_add_delayed (
1742 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5),
1743 churn,
1744 NULL);
1745 }
1746 else
1747 {
1748 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1749 "Not starting churn task\n");
1750 }
1751
1752 schedule_missing_requests (rps_peer);
1753}
1754
1755 1694
1756/*********************************** 1695/***********************************
1757* PROFILER 1696* PROFILER
@@ -2652,10 +2591,11 @@ pre_profiler (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
2652 store_prefix_file_name (rps_peer->index, "probs"); 2591 store_prefix_file_name (rps_peer->index, "probs");
2653 rps_peer->file_name_probs_hist = 2592 rps_peer->file_name_probs_hist =
2654 store_prefix_file_name (rps_peer->index, "probs_hist"); 2593 store_prefix_file_name (rps_peer->index, "probs_hist");
2594 rps_peer->eval_probs_cache = GNUNET_new_array (num_peers, double);
2595 memset (rps_peer->eval_probs_cache, 0, num_peers * sizeof (double));
2655 GNUNET_RPS_view_request (h, 0, view_update_cb, rps_peer); 2596 GNUNET_RPS_view_request (h, 0, view_update_cb, rps_peer);
2656} 2597}
2657 2598
2658
2659void 2599void
2660write_final_stats (void) 2600write_final_stats (void)
2661{ 2601{
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index ecbc8e208..dc4c5dab7 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -596,8 +596,10 @@ static const uint32_t num_valid_peers_max = UINT32_MAX;
596static void 596static void
597do_round (void *cls); 597do_round (void *cls);
598 598
599#if ENABLE_MALICIOUS
599static void 600static void
600do_mal_round (void *cls); 601do_mal_round (void *cls);
602#endif /* ENABLE_MALICIOUS */
601 603
602 604
603/** 605/**
@@ -2464,6 +2466,7 @@ resize_wrapper (struct RPS_Sampler *sampler, uint32_t new_size)
2464} 2466}
2465 2467
2466 2468
2469#if ENABLE_MALICIOUS
2467/** 2470/**
2468 * Add all peers in @a peer_array to @a peer_map used as set. 2471 * Add all peers in @a peer_array to @a peer_map used as set.
2469 * 2472 *
@@ -2500,6 +2503,7 @@ add_peer_array_to_set (const struct GNUNET_PeerIdentity *peer_array,
2500 } 2503 }
2501 } 2504 }
2502} 2505}
2506#endif /* ENABLE_MALICIOUS */
2503 2507
2504 2508
2505/** 2509/**
@@ -2948,12 +2952,16 @@ new_sub (const struct GNUNET_HashCode *hash,
2948 2952
2949 /* Logging of internals */ 2953 /* Logging of internals */
2950#ifdef TO_FILE_FULL 2954#ifdef TO_FILE_FULL
2951 sub->file_name_view_log = store_prefix_file_name (&own_identity, "view"); 2955 // FIXME: The service cannot know the index, which is required by this
2956 // function:
2957 // sub->file_name_view_log = store_prefix_file_name (&own_identity, "view");
2952#endif /* TO_FILE_FULL */ 2958#endif /* TO_FILE_FULL */
2953#ifdef TO_FILE 2959#ifdef TO_FILE
2954#ifdef TO_FILE_FULL 2960#ifdef TO_FILE_FULL
2955 sub->file_name_observed_log = store_prefix_file_name (&own_identity, 2961 // FIXME: The service cannot know the index, which is required by this
2956 "observed"); 2962 // function:
2963 // sub->file_name_observed_log = store_prefix_file_name (&own_identity,
2964 // "observed");
2957#endif /* TO_FILE_FULL */ 2965#endif /* TO_FILE_FULL */
2958 sub->num_observed_peers = 0; 2966 sub->num_observed_peers = 0;
2959 sub->observed_unique_peers = GNUNET_CONTAINER_multipeermap_create (1, 2967 sub->observed_unique_peers = GNUNET_CONTAINER_multipeermap_create (1,
@@ -2981,46 +2989,50 @@ new_sub (const struct GNUNET_HashCode *hash,
2981 2989
2982 2990
2983#ifdef TO_FILE 2991#ifdef TO_FILE
2984/** 2992// /**
2985 * @brief Write all numbers in the given array into the given file 2993// * @brief Write all numbers in the given array into the given file
2986 * 2994// *
2987 * Single numbers devided by a newline 2995// * Single numbers devided by a newline
2988 * 2996// *
2989 * @param hist_array[] the array to dump 2997// * FIXME: The call to store_prefix_file_name expects the index of the peer,
2990 * @param file_name file to dump into 2998// * which cannot be known to the service.
2991 */ 2999// * Write a dedicated function that uses the peer id.
2992static void 3000// *
2993write_histogram_to_file (const uint32_t hist_array[], 3001// * @param hist_array[] the array to dump
2994 const char *file_name) 3002// * @param file_name file to dump into
2995{ 3003// */
2996 char collect_str[SIZE_DUMP_FILE + 1] = ""; 3004// static void
2997 char *recv_str_iter; 3005// write_histogram_to_file (const uint32_t hist_array[],
2998 char *file_name_full; 3006// const char *file_name)
2999 3007// {
3000 recv_str_iter = collect_str; 3008// char collect_str[SIZE_DUMP_FILE + 1] = "";
3001 file_name_full = store_prefix_file_name (&own_identity, 3009// char *recv_str_iter;
3002 file_name); 3010// char *file_name_full;
3003 for (uint32_t i = 0; i < HISTOGRAM_FILE_SLOTS; i++) 3011//
3004 { 3012// recv_str_iter = collect_str;
3005 char collect_str_tmp[8]; 3013// file_name_full = store_prefix_file_name (&own_identity,
3006 3014// file_name);
3007 GNUNET_snprintf (collect_str_tmp, 3015// for (uint32_t i = 0; i < HISTOGRAM_FILE_SLOTS; i++)
3008 sizeof(collect_str_tmp), 3016// {
3009 "%" PRIu32 "\n", 3017// char collect_str_tmp[8];
3010 hist_array[i]); 3018//
3011 recv_str_iter = stpncpy (recv_str_iter, 3019// GNUNET_snprintf (collect_str_tmp,
3012 collect_str_tmp, 3020// sizeof(collect_str_tmp),
3013 6); 3021// "%" PRIu32 "\n",
3014 } 3022// hist_array[i]);
3015 (void) stpcpy (recv_str_iter, 3023// recv_str_iter = stpncpy (recv_str_iter,
3016 "\n"); 3024// collect_str_tmp,
3017 LOG (GNUNET_ERROR_TYPE_DEBUG, 3025// 6);
3018 "Writing push stats to disk\n"); 3026// }
3019 to_file_w_len (file_name_full, 3027// (void) stpcpy (recv_str_iter,
3020 SIZE_DUMP_FILE, "%s", 3028// "\n");
3021 collect_str); 3029// LOG (GNUNET_ERROR_TYPE_DEBUG,
3022 GNUNET_free (file_name_full); 3030// "Writing push stats to disk\n");
3023} 3031// to_file_w_len (file_name_full,
3032// SIZE_DUMP_FILE, "%s",
3033// collect_str);
3034// GNUNET_free (file_name_full);
3035// }
3024 3036
3025 3037
3026#endif /* TO_FILE */ 3038#endif /* TO_FILE */
@@ -3065,17 +3077,18 @@ destroy_sub (struct Sub *sub)
3065 sub->file_name_observed_log = NULL; 3077 sub->file_name_observed_log = NULL;
3066#endif /* TO_FILE_FULL */ 3078#endif /* TO_FILE_FULL */
3067 3079
3068 /* Write push frequencies to disk */ 3080 // FIXME: Currently this calls malfunctionning code
3069 write_histogram_to_file (sub->push_recv, 3081 // /* Write push frequencies to disk */
3070 "push_recv"); 3082 // write_histogram_to_file (sub->push_recv,
3083 // "push_recv");
3071 3084
3072 /* Write push deltas to disk */ 3085 // /* Write push deltas to disk */
3073 write_histogram_to_file (sub->push_delta, 3086 // write_histogram_to_file (sub->push_delta,
3074 "push_delta"); 3087 // "push_delta");
3075 3088
3076 /* Write pull delays to disk */ 3089 // /* Write pull delays to disk */
3077 write_histogram_to_file (sub->pull_delays, 3090 // write_histogram_to_file (sub->pull_delays,
3078 "pull_delays"); 3091 // "pull_delays");
3079 3092
3080 GNUNET_CONTAINER_multipeermap_destroy (sub->observed_unique_peers); 3093 GNUNET_CONTAINER_multipeermap_destroy (sub->observed_unique_peers);
3081 sub->observed_unique_peers = NULL; 3094 sub->observed_unique_peers = NULL;
diff --git a/src/rps/rps-sampler_client.c b/src/rps/rps-sampler_client.c
index 5ab854e01..f6e98ce29 100644
--- a/src/rps/rps-sampler_client.c
+++ b/src/rps/rps-sampler_client.c
@@ -258,39 +258,39 @@ RPS_sampler_mod_init (size_t init_size,
258} 258}
259 259
260 260
261/** 261// /**
262 * @brief Compute the probability that we already observed all peers from a 262// * @brief Compute the probability that we already observed all peers from a
263 * biased stream of peer ids. 263// * biased stream of peer ids.
264 * 264// *
265 * Deficiency factor: 265// * Deficiency factor:
266 * As introduced by Brahms: Factor between the number of unique ids in a 266// * As introduced by Brahms: Factor between the number of unique ids in a
267 * truly random stream and number of unique ids in the gossip stream. 267// * truly random stream and number of unique ids in the gossip stream.
268 * 268// *
269 * @param num_peers_estim The estimated number of peers in the network 269// * @param num_peers_estim The estimated number of peers in the network
270 * @param num_peers_observed The number of peers the given element has observed 270// * @param num_peers_observed The number of peers the given element has observed
271 * @param deficiency_factor A factor that catches the 'bias' of a random stream 271// * @param deficiency_factor A factor that catches the 'bias' of a random stream
272 * of peer ids 272// * of peer ids
273 * 273// *
274 * @return The estimated probability 274// * @return The estimated probability
275 */ 275// */
276static double 276// static double
277prob_observed_n_peers (uint32_t num_peers_estim, 277// prob_observed_n_peers (uint32_t num_peers_estim,
278 uint32_t num_peers_observed, 278// uint32_t num_peers_observed,
279 double deficiency_factor) 279// double deficiency_factor)
280{ 280// {
281 uint32_t num_peers = num_peers_estim * (1 / deficiency_factor); 281// uint32_t num_peers = num_peers_estim * (1 / deficiency_factor);
282 uint64_t sum = 0; 282// uint64_t sum = 0;
283 283//
284 for (uint32_t i = 0; i < num_peers; i++) 284// for (uint32_t i = 0; i < num_peers; i++)
285 { 285// {
286 uint64_t a = pow (-1, num_peers - i); 286// uint64_t a = pow (-1, num_peers - i);
287 uint64_t b = binom (num_peers, i); 287// uint64_t b = binom (num_peers, i);
288 uint64_t c = pow (i, num_peers_observed); 288// uint64_t c = pow (i, num_peers_observed);
289 sum += a * b * c; 289// sum += a * b * c;
290 } 290// }
291 291//
292 return sum / (double) pow (num_peers, num_peers_observed); 292// return sum / (double) pow (num_peers, num_peers_observed);
293} 293// }
294 294
295 295
296/** 296/**
@@ -379,7 +379,8 @@ sampler_mod_get_rand_peer (void *cls)
379 return; 379 return;
380 } 380 }
381 /* compute probability */ 381 /* compute probability */
382 /* Currently disabled due to numerical limitations */ 382 /* FIXME: Currently disabled due to numerical limitations */
383 prob_observed_n = 0; // Inititialise to some value
383 // prob_observed_n = prob_observed_n_peers (sampler->num_peers_estim, 384 // prob_observed_n = prob_observed_n_peers (sampler->num_peers_estim,
384 // s_elem->num_peers, 385 // s_elem->num_peers,
385 // sampler->deficiency_factor); 386 // sampler->deficiency_factor);
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index d2cdd3aa7..b73be3457 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -186,7 +186,7 @@ to_file_raw (const char *file_name, const char *buf, size_t size_buf)
186 if (size_buf != size_written) 186 if (size_buf != size_written)
187 { 187 {
188 LOG (GNUNET_ERROR_TYPE_WARNING, 188 LOG (GNUNET_ERROR_TYPE_WARNING,
189 "Unable to write to file! (Size: %u, size_written: %u)\n", 189 "Unable to write to file! (Size: %zu, size_written: %zu)\n",
190 size_buf, 190 size_buf,
191 size_written); 191 size_written);
192 192
@@ -197,7 +197,7 @@ to_file_raw (const char *file_name, const char *buf, size_t size_buf)
197 return; 197 return;
198 } 198 }
199 LOG (GNUNET_ERROR_TYPE_WARNING, 199 LOG (GNUNET_ERROR_TYPE_WARNING,
200 "Wrote %u bytes raw.\n", 200 "Wrote %zu bytes raw.\n",
201 size_written); 201 size_written);
202 if (GNUNET_YES != GNUNET_DISK_file_close (f)) 202 if (GNUNET_YES != GNUNET_DISK_file_close (f))
203 LOG (GNUNET_ERROR_TYPE_WARNING, 203 LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -238,7 +238,7 @@ to_file_raw_unaligned (const char *file_name,
238 "num_bits_buf_unaligned: %u\n", 238 "num_bits_buf_unaligned: %u\n",
239 num_bits_buf_unaligned); 239 num_bits_buf_unaligned);
240 LOG (GNUNET_ERROR_TYPE_DEBUG, 240 LOG (GNUNET_ERROR_TYPE_DEBUG,
241 "ua args: size_buf: %u, bits_needed: %u -> iter: %u\n", 241 "ua args: size_buf: %zu, bits_needed: %u -> iter: %u\n",
242 size_buf, 242 size_buf,
243 bits_needed, 243 bits_needed,
244 bytes_iter); 244 bytes_iter);
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h
index 2f11f0105..72aa78803 100644
--- a/src/rps/rps-test_util.h
+++ b/src/rps/rps-test_util.h
@@ -73,7 +73,7 @@ close_all_files ();
73 "Failed to create tmp_buf\n"); \ 73 "Failed to create tmp_buf\n"); \
74 break; \ 74 break; \
75 } \ 75 } \
76 (void) strncat (tmp_buf, "\n", 512); \ 76 (void) strncat (tmp_buf, "\n", 511); \
77 GNUNET_DISK_file_write (get_file_handle (file_name), \ 77 GNUNET_DISK_file_write (get_file_handle (file_name), \
78 tmp_buf, \ 78 tmp_buf, \
79 strnlen (tmp_buf, 512)); \ 79 strnlen (tmp_buf, 512)); \
@@ -94,8 +94,7 @@ close_all_files ();
94 "Failed to create tmp_buf\n"); \ 94 "Failed to create tmp_buf\n"); \
95 break; \ 95 break; \
96 } \ 96 } \
97 (void) strncat (tmp_buf, "\n", \ 97 (void) strncat (tmp_buf, "\n", 2); \
98 len); \
99 GNUNET_DISK_file_write ( \ 98 GNUNET_DISK_file_write ( \
100 get_file_handle (file_name), \ 99 get_file_handle (file_name), \
101 tmp_buf, \ 100 tmp_buf, \
diff --git a/src/rps/test_service_rps_custommap.c b/src/rps/test_service_rps_custommap.c
index 05590b097..3d885ca6b 100644
--- a/src/rps/test_service_rps_custommap.c
+++ b/src/rps/test_service_rps_custommap.c
@@ -35,7 +35,7 @@ check ()
35 struct CustomPeerMap *c_m; 35 struct CustomPeerMap *c_m;
36 struct GNUNET_PeerIdentity k1; 36 struct GNUNET_PeerIdentity k1;
37 struct GNUNET_PeerIdentity k2; 37 struct GNUNET_PeerIdentity k2;
38 int j; 38 unsigned int j;
39 39
40 CHECK (NULL != (c_m = CustomPeerMap_create (4))); 40 CHECK (NULL != (c_m = CustomPeerMap_create (4)));
41 memset (&k1, 0, sizeof(k1)); 41 memset (&k1, 0, sizeof(k1));