aboutsummaryrefslogtreecommitdiff
path: root/src/rps/rps-test_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/rps-test_util.c')
-rw-r--r--src/rps/rps-test_util.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index fcb4f59a0..ab023a7a6 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -456,18 +456,29 @@ ensure_folder_exist (void)
456 456
457 457
458char * 458char *
459store_prefix_file_name (const struct GNUNET_PeerIdentity *peer, 459store_prefix_file_name (const unsigned int index,
460 const char *prefix) 460 const char *prefix)
461{ 461{
462 int len_file_name; 462 int len_file_name;
463 int out_size; 463 int out_size;
464 char *file_name; 464 char *file_name;
465 const char *pid_long; 465 char index_str[64];
466 466
467 if (GNUNET_SYSERR == ensure_folder_exist()) return NULL; 467 if (GNUNET_SYSERR == ensure_folder_exist()) return NULL;
468 pid_long = GNUNET_i2s_full (peer); 468 out_size = GNUNET_snprintf (index_str,
469 64,
470 "%u",
471 index);
472 if (64 < out_size ||
473 0 > out_size)
474 {
475 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
476 "Failed to write string to buffer (size: %i, out_size: %i)\n",
477 64,
478 out_size);
479 }
469 len_file_name = (strlen (prefix) + 480 len_file_name = (strlen (prefix) +
470 strlen (pid_long) + 481 strlen (index_str) +
471 11) 482 11)
472 * sizeof (char); 483 * sizeof (char);
473 file_name = GNUNET_malloc (len_file_name); 484 file_name = GNUNET_malloc (len_file_name);
@@ -475,7 +486,7 @@ store_prefix_file_name (const struct GNUNET_PeerIdentity *peer,
475 len_file_name, 486 len_file_name,
476 "/tmp/rps/%s-%s", 487 "/tmp/rps/%s-%s",
477 prefix, 488 prefix,
478 pid_long); 489 index_str);
479 if (len_file_name < out_size || 490 if (len_file_name < out_size ||
480 0 > out_size) 491 0 > out_size)
481 { 492 {