diff options
Diffstat (limited to 'src/nse/gnunet-nse-profiler.c')
-rw-r--r-- | src/nse/gnunet-nse-profiler.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index a18a13fbd..ecd594e86 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c | |||
@@ -137,8 +137,6 @@ static GNUNET_SCHEDULER_TaskIdentifier churn_task; | |||
137 | 137 | ||
138 | static char *topology_file; | 138 | static char *topology_file; |
139 | 139 | ||
140 | static char *data_filename; | ||
141 | |||
142 | static uint64_t clock_skew; | 140 | static uint64_t clock_skew; |
143 | 141 | ||
144 | /** | 142 | /** |
@@ -540,6 +538,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
540 | char *temp_str; | 538 | char *temp_str; |
541 | unsigned long long temp_wait; | 539 | unsigned long long temp_wait; |
542 | struct GNUNET_TESTING_Host *hosts; | 540 | struct GNUNET_TESTING_Host *hosts; |
541 | char *data_filename; | ||
543 | 542 | ||
544 | ok = 1; | 543 | ok = 1; |
545 | testing_cfg = GNUNET_CONFIGURATION_create (); | 544 | testing_cfg = GNUNET_CONFIGURATION_create (); |
@@ -584,14 +583,21 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
584 | return; | 583 | return; |
585 | } | 584 | } |
586 | 585 | ||
587 | if (GNUNET_OK != | 586 | if (GNUNET_OK == |
588 | GNUNET_CONFIGURATION_get_value_string (testing_cfg, "nse-profiler", | 587 | GNUNET_CONFIGURATION_get_value_string (testing_cfg, "nse-profiler", |
589 | "data_output_file", | 588 | "data_output_file", |
590 | &data_filename)) | 589 | &data_filename)) |
591 | { | 590 | { |
592 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 591 | data_file = |
593 | "Option nse-profiler:data_output_file is required!\n"); | 592 | GNUNET_DISK_file_open (data_filename, |
594 | return; | 593 | GNUNET_DISK_OPEN_READWRITE | |
594 | GNUNET_DISK_OPEN_CREATE, | ||
595 | GNUNET_DISK_PERM_USER_READ | | ||
596 | GNUNET_DISK_PERM_USER_WRITE); | ||
597 | if (data_file == NULL) | ||
598 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", | ||
599 | data_filename); | ||
600 | GNUNET_free (data_filename); | ||
595 | } | 601 | } |
596 | 602 | ||
597 | if (GNUNET_YES == | 603 | if (GNUNET_YES == |
@@ -605,17 +611,6 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
605 | } | 611 | } |
606 | 612 | ||
607 | 613 | ||
608 | data_file = | ||
609 | GNUNET_DISK_file_open (data_filename, | ||
610 | GNUNET_DISK_OPEN_READWRITE | | ||
611 | GNUNET_DISK_OPEN_CREATE, | ||
612 | GNUNET_DISK_PERM_USER_READ | | ||
613 | GNUNET_DISK_PERM_USER_WRITE); | ||
614 | if (data_file == NULL) | ||
615 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", | ||
616 | data_filename); | ||
617 | GNUNET_free (data_filename); | ||
618 | |||
619 | wait_time = | 614 | wait_time = |
620 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_wait); | 615 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_wait); |
621 | 616 | ||