From: Florian Forster Date: Mon, 10 Sep 2012 19:10:45 +0000 (+0200) Subject: Merge branch 'ff/kstat' into collectd-4.10 X-Git-Tag: collectd-5.0.5~4^2~18 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=dd5fc7ca70168375863161967d6738914ea008b7;hp=77f03c91b3074b5abd3e602002b7fc7ce28ea612;p=collectd.git Merge branch 'ff/kstat' into collectd-4.10 --- diff --git a/src/common.c b/src/common.c index 3bab7a59..35e006a2 100644 --- a/src/common.c +++ b/src/common.c @@ -635,24 +635,23 @@ long long get_kstat_value (kstat_t *ksp, char *name) kstat_named_t *kn; long long retval = -1LL; -#ifdef assert - assert (ksp != NULL); - assert (ksp->ks_type == KSTAT_TYPE_NAMED); -#else if (ksp == NULL) { - ERROR ("ERROR: %s:%i: ksp == NULL\n", __FILE__, __LINE__); + ERROR ("get_kstat_value (\"%s\"): ksp is NULL.", name); return (-1LL); } else if (ksp->ks_type != KSTAT_TYPE_NAMED) { - ERROR ("ERROR: %s:%i: ksp->ks_type != KSTAT_TYPE_NAMED\n", __FILE__, __LINE__); + ERROR ("get_kstat_value (\"%s\"): ksp->ks_type (%#x) " + "is not KSTAT_TYPE_NAMED (%#x).", + name, + (unsigned int) ksp->ks_type, + (unsigned int) KSTAT_TYPE_NAMED); return (-1LL); } -#endif if ((kn = (kstat_named_t *) kstat_data_lookup (ksp, name)) == NULL) - return (retval); + return (-1LL); if (kn->data_type == KSTAT_DATA_INT32) retval = (long long) kn->value.i32;