Skip to content
Snippets Groups Projects
Commit 2263acd2 authored by Georges Da Costa's avatar Georges Da Costa
Browse files

Corrects a bug when no output file are present

parent e13ea0e1
Branches
No related tags found
1 merge request!12Libmoj
...@@ -13,8 +13,8 @@ OPTIONS: ...@@ -13,8 +13,8 @@ OPTIONS:
set amount of measurements per second. set amount of measurements per second.
-t|--time <time> -t|--time <time>
set duration value (seconds). If 0, then loops infinitely. set duration value (seconds). If 0, then loops infinitely.
-o|--logfile <file> -o|--option <output file> or <port number>
specify a log file. specify a log file for MojitO/S or a port number for prometeus_mojitO/S.
-s|--overhead-stats -s|--overhead-stats
enable overhead statistics (nanoseconds). enable overhead statistics (nanoseconds).
......
...@@ -9,13 +9,13 @@ extern FILE *output; ...@@ -9,13 +9,13 @@ extern FILE *output;
extern char* output_option; extern char* output_option;
void init_manager(char** labels, int nb_sensors, int stat_mode) { void init_manager(char** labels, int nb_sensors, int stat_mode) {
if (output_option != NULL) {
if ((output = fopen(output_option, "wb")) == NULL) { if ((output = fopen(output_option, "wb")) == NULL) {
perror("fopen"); perror("fopen");
PANIC(1, "-o %s", output_option); PANIC(1, "-o %s", output_option);
}
} }
fprintf(output, "#timestamp "); fprintf(output, "#timestamp ");
for (int i = 0; i < nb_sensors; i++) { for (int i = 0; i < nb_sensors; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment