aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiomidis Spinellis <dds@FreeBSD.org>2007-08-31 13:36:58 +0000
committerDiomidis Spinellis <dds@FreeBSD.org>2007-08-31 13:36:58 +0000
commit72de1b3709b3b59754fcd33cf8cc139a012c39a9 (patch)
tree9a326147dcf1552554cf44757b1137912e351011
parentc961faca8cbe1ef16544e91283322e7abc8eeb13 (diff)
downloadsrc-72de1b3709b3b59754fcd33cf8cc139a012c39a9.tar.gz
src-72de1b3709b3b59754fcd33cf8cc139a012c39a9.zip
Don't panic. When encountering a negative value call log(LOG_NOTICE, ...)
and record LONG_MAX, instead of calling KASSERT(...). Reported by: rwatson Approved by: re (kensmith)
Notes
Notes: svn path=/head/; revision=172023
-rw-r--r--sys/kern/kern_acct.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 269b4e481398..76791a8fffe9 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
#include <sys/fcntl.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
+#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mount.h>
#include <sys/mutex.h>
@@ -522,9 +523,14 @@ encode_long(long val)
int norm_exp; /* Normalized exponent */
int shift;
- KASSERT(val >= 0, ("encode_long: -ve value %ld", val));
if (val == 0)
return (0);
+ if (val < 0) {
+ log(LOG_NOTICE,
+ "encode_long: negative value %ld in accounting record",
+ val);
+ val = LONG_MAX;
+ }
norm_exp = fls(val) - 1;
shift = FLT_MANT_DIG - norm_exp - 1;
#ifdef ACCT_DEBUG