summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9b87126)
raw | patch | inline | side by side (parent: 9b87126)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 20 Apr 2007 07:09:48 +0000 (09:09 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 20 Apr 2007 07:09:48 +0000 (09:09 +0200) |
src/unixsock.c | patch | blob | history |
diff --git a/src/unixsock.c b/src/unixsock.c
index 8524beadd6fed8a30349179555ecd95e52f104e8..1ddd03cf35f662160dda195c9de760edf646c384 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
vc = cache_search (name);
+ /* pthread_mutex_lock is called by cache_insert. */
if (vc == NULL)
return (cache_insert (ds, vl));
assert (vc->values_num == ds->ds_num);
assert (vc->values_num == vl->values_len);
+ /* Avoid floating-point exceptions due to division by zero. */
+ if (vc->time >= vl->time)
+ {
+ pthread_mutex_unlock (&cache_lock);
+ ERROR ("unixsock plugin: vc->time >= vl->time. vc->time = %u; "
+ "vl->time = %u; vl = %s;",
+ (unsigned int) vc->time, (unsigned int) vl->time,
+ name);
+ return (-1);
+ } /* if (vc->time >= vl->time) */
+
/*
* Update the values. This is possibly a lot more that you'd expect
* because we honor min and max values and handle counter overflows here.