diff options
author | sheldonh <sheldonh@FreeBSD.org> | 1999-07-22 17:33:11 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 1999-07-22 17:33:11 +0000 |
commit | 52eee06a54a722fd13efe839648ef2154e29a263 (patch) | |
tree | a2f00f902ca39ba72fec39f93f191d08e521ee4b /usr.bin/jot | |
parent | a2b1df94ad3af9d024aee5d5312d143cfbd269d3 (diff) | |
download | FreeBSD-src-52eee06a54a722fd13efe839648ef2154e29a263.zip FreeBSD-src-52eee06a54a722fd13efe839648ef2154e29a263.tar.gz |
Don't dump core for a known, documented bug.
PR: 12611
Reviewed by: markm
Diffstat (limited to 'usr.bin/jot')
-rw-r--r-- | usr.bin/jot/jot.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/usr.bin/jot/jot.c b/usr.bin/jot/jot.c index 7dd4261..7d96f2b 100644 --- a/usr.bin/jot/jot.c +++ b/usr.bin/jot/jot.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)jot.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: jot.c,v 1.9 1999/05/13 12:18:24 kris Exp $"; + "$Id: jot.c,v 1.10 1999/07/22 17:11:59 sheldonh Exp $"; #endif /* not lint */ /* @@ -54,6 +54,7 @@ static const char rcsid[] = #include <ctype.h> #include <err.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -79,9 +80,13 @@ int intdata; int chardata; int nosign; int nofinalnl; +int oflowlen; +char *oflowstr; char *sepstring = "\n"; char format[BUFSIZ]; +struct sigaction act, oact; +void arith_oflow __P((int)); void getargs __P((int, char *[])); void getformat __P((void)); int getprec __P((char *)); @@ -99,6 +104,13 @@ main(argc, argv) register double *y = &yd; register long *i = &id; + act.sa_handler = arith_oflow; + act.sa_flags = 0; + sigfillset(&act.sa_mask); + oflowstr = "caught SIGFPE: arithmetic overflow\n"; + oflowlen = strlen(oflowstr); + if (sigaction(SIGFPE, &act, &oact)) + err(1, "loading SIGFPE handler"); getargs(argc, argv); if (randomize) { *x = (ender - begin) * (ender > begin ? 1 : -1); @@ -449,3 +461,11 @@ getformat() } } } + +void +arith_oflow(int sig) +{ + + write(STDERR_FILENO, oflowstr, oflowlen); + _exit(sig); +} |