ltlcross: detect write errors for --save-bogus and --grind

* bin/ltlcross.cc: Explicitly close those files to check for
error conditions.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2020-03-13 07:52:34 +01:00
parent 0940c9a25a
commit c368903398
2 changed files with 15 additions and 2 deletions

3
NEWS
View file

@ -18,6 +18,9 @@ New in spot 2.8.6.dev (not yet released)
wrong. This could in turn cause segfaults or infinite loops while
running autcross or autfilt --stats=%w.
- ltlcross was not diagnosing write errors associated to
options --grind=FILENAME and --save-bogus=FILENAME.
New in spot 2.8.6 (2020-02-19)
Bugs fixed:

View file

@ -220,6 +220,7 @@ static bool products_avg = true;
static bool opt_omit = false;
static const char* bogus_output_filename = nullptr;
static output_file* bogus_output = nullptr;
static const char* grind_output_filename = nullptr;
static output_file* grind_output = nullptr;
static bool verbose = false;
static bool quiet = false;
@ -507,6 +508,7 @@ parse_opt(int key, char* arg, struct argp_state*)
fail_on_timeout = true;
break;
case OPT_GRIND:
grind_output_filename = arg;
grind_output = new output_file(arg);
break;
case OPT_IGNORE_EXEC_FAIL:
@ -1800,8 +1802,16 @@ main(int argc, char** argv)
}
}
delete bogus_output;
delete grind_output;
if (bogus_output)
{
bogus_output->close(bogus_output_filename);
delete bogus_output;
}
if (grind_output)
{
grind_output->close(grind_output_filename);
delete grind_output;
}
if (json_output)
print_stats_json(json_output);