blob: 9681907335f80010e658f110f1bb3a7d63f7da7b (
plain) (
tree)
|
|
See also:
* https://git.adelielinux.org/adelie/packages/-/issues/1045#note_13472
--- a/cobc/cobc.c.gc32 Sat Jul 22 17:01:52 2023
+++ b/cobc/cobc.c Thu Aug 17 23:01:33 2023
@@ -2358,6 +2358,10 @@
DECLNORET static void COB_A_NORETURN
cobc_terminate (const char *str)
{
+ /* must be executed before anything that may adjust errno, ...
+ like the listing code below. */
+ const char *errno_str = cb_get_strerror ();
+
if (cb_src_list_file) {
set_listing_date ();
set_standard_title ();
@@ -2365,7 +2369,7 @@
cobc_elided_strcpy (cb_listing_filename, str, sizeof (cb_listing_filename), 0);
print_program_header ();
}
- cb_perror (0, "cobc: %s: %s", str, cb_get_strerror ());
+ cb_perror (0, "cobc: %s: %s", str, errno_str);
if (cb_src_list_file) {
print_program_trailer ();
}
|