From c36890339853aa7efc8088f9161dbcbf18698e40 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 13 Mar 2020 07:52:34 +0100 Subject: [PATCH] ltlcross: detect write errors for --save-bogus and --grind * bin/ltlcross.cc: Explicitly close those files to check for error conditions. * NEWS: Mention it. --- NEWS | 3 +++ bin/ltlcross.cc | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index cfcc7d15a..f7ed80fac 100644 --- a/NEWS +++ b/NEWS @@ -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: diff --git a/bin/ltlcross.cc b/bin/ltlcross.cc index efafe7b31..ec53e1c78 100644 --- a/bin/ltlcross.cc +++ b/bin/ltlcross.cc @@ -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);