lang/gforth: Use calloc to work around an RWX mmap used for sigaltstack

which causes noisy printfs. "Using calloc looks good to me" deraadt

No feedback from maintainer in over a week.
This commit is contained in:
tb 2022-10-25 12:59:55 +00:00
parent 5e9e6344cb
commit 1962608078
3 changed files with 27 additions and 2 deletions

View File

@ -6,7 +6,7 @@ COMMENT = ANSI/200x Forth interpreter and compiler
V = 0.7.3
DISTNAME = gforth-${V}
REVISION = 3
REVISION = 4
CATEGORIES = lang
SHARED_LIBS += ffi 0.0 # 0.0

View File

@ -0,0 +1,25 @@
Avoid sigaltstack with an RWX mmap.
Index: engine/signals.c
--- engine/signals.c.orig
+++ engine/signals.c
@@ -403,13 +403,18 @@ void install_signal_handlers(void)
#ifdef SIGSTKSZ
stack_t sigstack;
int sas_retval=-1;
+ extern char *progname;
sigstack.ss_size=SIGSTKSZ;
/* Actually the stack should only be ss_size large, and according to
SUSv2 ss_sp should point to the start of the stack, but
unfortunately Irix 6.5 (at least) expects ss_sp to point to the
end, so we work around this issue by accomodating everyone. */
- if ((sigstack.ss_sp = gforth_alloc(sigstack.ss_size*2)) != NULL) {
+ if ((sigstack.ss_sp = calloc(sigstack.ss_size, 2)) == NULL) {
+ perror(progname);
+ exit(1);
+ }
+ if (sigstack.ss_sp != NULL) {
sigstack.ss_sp += sigstack.ss_size;
sigstack.ss_flags=0;
sas_retval=sigaltstack(&sigstack,(stack_t *)0);

View File

@ -25,7 +25,7 @@ lib/gforth/${V}/libcc-named/cstr.so.0.0
lib/gforth/${V}/libcc-named/fflib.a
lib/gforth/${V}/libcc-named/fflib.la
lib/gforth/${V}/libcc-named/fflib.so.0.0
lib/gforth/${V}/libcc-named/libffi.a
@static-lib lib/gforth/${V}/libcc-named/libffi.a
lib/gforth/${V}/libcc-named/libffi.la
@lib lib/gforth/${V}/libcc-named/libffi.so.${LIBffi_VERSION}
lib/gforth/${V}/libcc-named/socket.a