Re: Floating point exception (core dumped) (v0.91.2)

From: Jared Mauch (jared@puck.nether.net)
Date: Sun Aug 19 2001 - 11:53:46 EDT


        This patch should fix this software defect.

        the + represents the lines to add and the - lines to delete
from the original source. I will make a new release shortly to
fix this bug.

        Thanks for the report.

cvs diff: Diffing .
Index: textfile.c
===================================================================
RCS file: /home/jared/src/sysmon/cvs/sysmon/src/textfile.c,v
retrieving revision 1.15
diff -u -r1.15 textfile.c
--- textfile.c 2001/06/08 19:15:44 1.15
+++ textfile.c 2001/08/19 15:51:10
@@ -139,9 +139,11 @@
                }
                 tmp1 = down.totaldown;
                 tmp2 = down.totalchecked;
- value = (100.0000-((tmp1/tmp2) * 100));
+ if (tmp2 != 0)
+ value = (100.0000-((tmp1/tmp2) * 100));
+ else
+ value = 100;
                 if (value<0) value=0.000;
- if (tmp2==0) value=100.00;
                 snprintf(tmp, 1024, "%10.2f%%",value);
 
                fprintf(fh,

        - jared

On Sun, Aug 19, 2001 at 10:03:29AM +0200, Bengt Gördén wrote:
>
> I use sysmon to monitor SUNET (Swedish University Network) and I have
> had very good experience with it. I did upgrade last week to 0.91.2. I
> also did turn on the "config showupalso". At first when I started
> sysmond all looked ok but when I made a change in the sysmon.conf it
> coredumped. I thought that I had made a misstake in the config and
> reverted to the old config. But there were still coredumps. I run it
> on FreeBSD 3.2. When I tried gdb it came up with the text down
> below. I'm not a C-programmer so I thought that someone on this list
> maby could help out.
>
>
>
>
> bash-2.03# sysmond -d -f /etc/sysmon.conf
> booting of version System Monitor version v0.91.2
> System Monitor version v0.91.2
> sysmond started on stats.se
> Floating point exception (core dumped)
>
>
>
> bash-2.03# gdb /usr/local/bin/sysmond sysmond.core.1
> GNU gdb 4.18
> Copyright 1998 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "i386-unknown-freebsd"...
> Core was generated by `sysmond'.
> Program terminated with signal 8, Floating point exception.
> Reading symbols from /usr/lib/libwrap.so.2...done.
> Reading symbols from /usr/lib/libc.so.3...done.
> Reading symbols from /usr/libexec/ld-elf.so.1...done.
> #0 0x8051204 in add_line (fh=0x280fc53c, down={
> hostname = 0x80815c0 "stockholm-2", type = 3, port = 0,
> message = 0x8081600 "stockholm-2",
> contact = 0x807fc30 "jour", snmp_community = 0x0,
> lastcheck = 0, username = 0x0, password = 0x0, hdr = 0x0, hdrval = 0x0,
> secret = 0x0, lastmsgid = 0x0,
> unique_id = 0x80815e0 "jOETFshIuWkYo9zw11OWQnesS", url = 0x0,
> url_text = 0x0, command = 0x0, totalchecked = 0, totaldown = 0,
> downct = 0, max_down = 5, reverse = 0 '\000', contacted = 0 '\000',
> lastcontacted = 0, contact_when_up = 1 '\001', queued = 0 '\000',
> inaddr = 0, lchecktime = 0, check_start = 0, deathtime = 0,
> last_up = 0}, html=1, now=998127523) at textfile.c:142
> 142 value = (100.0000-((tmp1/tmp2) * 100));
>
>
> --
>
> /Bengan
>
> Bengt Görden
> KTHNOC/SUNET/NORDUnet
> http://www.sunet.se/~bengan

-- 
Jared Mauch  | pgp key available via finger from jared@puck.nether.net
clue++;      | http://puck.nether.net/~jared/  My statements are only mine.



This archive was generated by hypermail 2b29 : Sun Aug 04 2002 - 04:14:07 EDT