[SIGAR-129] add another sanity check

This commit is contained in:
Doug MacEachern committed 2009-02-06 13:46:27 -08:00
1 parent bf61ce78a9
commit ede7b6c9de
1 file changed
+5
+5
View File
@@ -148,6 +148,11 @@ SIGAR_DECLARE(int) sigar_proc_cpu_get(sigar_t *sigar, sigar_pid_t pid,
memcpy(prev, proccpu, sizeof(*prev));
if (proccpu->total < otime) {
/* XXX this should not happen */
otime = 0;
}
if (otime == 0) {
proccpu->percent = 0.0;
/* first time called */