summaryrefslogtreecommitdiff
path: root/user/gnucobol/0002-errno.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/gnucobol/0002-errno.patch')
-rw-r--r--user/gnucobol/0002-errno.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/user/gnucobol/0002-errno.patch b/user/gnucobol/0002-errno.patch
new file mode 100644
index 000000000..968190733
--- /dev/null
+++ b/user/gnucobol/0002-errno.patch
@@ -0,0 +1,26 @@
+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 ();
+ }