freebsd-ports/lang/nawk/files/patch-main.c
Stefan Walter 76464cb48c Add patches:
- replace sprintf with snprintf
- use calloc() to avoid malloc(n * m) overflows
- NetBSD PR 36831: In setfval(), ensure that arithmetic never yields a negative
  zero result.
- Restore the traditional (FreeBSD <= 2.x) behavior of trapping FPEs. With this
  patch we pass mawk's fpe_test.

PR:		125348
Submitted by:	"Pedro F. Giffuni" <pfgshield-freebsd@yahoo.com>
2008-10-20 14:52:28 +00:00

19 lines
460 B
C

--- main.c.orig 2007-05-01 16:05:28.000000000 -0500
+++ main.c 2008-07-08 15:33:37.000000000 -0500
@@ -34,6 +34,8 @@
#include "awk.h"
#include "ytab.h"
+#include <fenv.h>
+
extern char **environ;
extern int nfields;
@@ -67,6 +69,7 @@
exit(1);
}
signal(SIGFPE, fpecatch);
+ feenableexcept(FE_DIVBYZERO|FE_INEXACT|FE_OVERFLOW);
yyin = NULL;
symtab = makesymtab(NSYMTAB/NSYMTAB);
while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') {