pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

trader: fix crash when built with NetBSD curses.



Module Name:	pkgsrc-wip
Committed By:	Frederic Cambus <fred%statdns.com@localhost>
Pushed By:	fcambus
Date:		Wed Jan 13 22:32:44 2021 +0100
Changeset:	1f2ab4957836570bd89446e511e843b885bee435

Modified Files:
	trader/distinfo
Added Files:
	trader/patches/patch-src_trader.c
Removed Files:
	trader/TODO

Log Message:
trader: fix crash when built with NetBSD curses.

Do not use err_exit() to generate error messages when locale initialization
fails as in this case curs_set() is called before initscr(), which causes
trader to crash when built with NetBSD curses.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=1f2ab4957836570bd89446e511e843b885bee435

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 trader/TODO                       |  4 ----
 trader/distinfo                   |  1 +
 trader/patches/patch-src_trader.c | 20 ++++++++++++++++++++
 3 files changed, 21 insertions(+), 4 deletions(-)

diffs:
diff --git a/trader/TODO b/trader/TODO
deleted file mode 100644
index 89a4bf8bc3..0000000000
--- a/trader/TODO
+++ /dev/null
@@ -1,4 +0,0 @@
-Trader crashes when LANG is set to anything else than C, because curs_set()
-is called before initscr() in the error path.
-
-There are issues with internationalization, notably in strfmon(3) output.
diff --git a/trader/distinfo b/trader/distinfo
index 4b8fc9a93d..7ce37a8f7a 100644
--- a/trader/distinfo
+++ b/trader/distinfo
@@ -4,3 +4,4 @@ SHA1 (trader-7.15.tar.gz) = 16c22694663685f62b11049c8787b39574ccc0a8
 RMD160 (trader-7.15.tar.gz) = 7f582b52be57c1fe8cba67d06076a3312c21030b
 SHA512 (trader-7.15.tar.gz) = 37cb302f23de1a8b68c75dce790d56abe63ba34d4dd1653c4af13044c66c8e08101d2ff724951489a5631384833ba2fda3d4d18730a46f97a115ff5dd6b45a75
 Size (trader-7.15.tar.gz) = 1251007 bytes
+SHA1 (patch-src_trader.c) = 7c5d5fb01b23bea6ab686ff825af5b555c579a66
diff --git a/trader/patches/patch-src_trader.c b/trader/patches/patch-src_trader.c
new file mode 100644
index 0000000000..05b80bfc83
--- /dev/null
+++ b/trader/patches/patch-src_trader.c
@@ -0,0 +1,20 @@
+$NetBSD$
+
+Do not use err_exit() to generate error messages when locale initialization
+fails as in this case curs_set() is called before initscr(), which causes
+trader to crash when built with NetBSD curses.
+
+--- src/trader.c.orig	2021-01-12 23:39:07.351997639 +0000
++++ src/trader.c
+@@ -151,8 +151,9 @@ int main (int argc, char *argv[])
+ 
+     // Initialise the locale
+     if (setlocale(LC_ALL, "") == NULL) {
+-	err_exit("could not set locale "
+-		 "(check LANG, LC_ALL and LANGUAGE in environment)");
++	fprintf(stderr, "%s: %s\n", program_name, "could not set locale "
++		"(check LANG, LC_ALL and LANGUAGE in environment)");
++	exit(EXIT_FAILURE);
+     }
+ 
+     // Use correct message catalogs for the locale


Home | Main Index | Thread Index | Old Index