X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fcommon.c;h=1af2f144647b191c38321ddd4aed4264b2c79577;hb=108068f268cad453e5d3b54e288917409db1e467;hp=b654719b6b94194644f328c6a0a318006222240e;hpb=6d86a97190a193863aadc252f20f6b9dba61c263;p=collectd.git diff --git a/src/common.c b/src/common.c index b654719b..1af2f144 100644 --- a/src/common.c +++ b/src/common.c @@ -531,26 +531,26 @@ int check_create_dir (const char *file_orig) int get_kstat (kstat_t **ksp_ptr, char *module, int instance, char *name) { char ident[128]; + + *ksp_ptr = NULL; if (kc == NULL) return (-1); ssnprintf (ident, sizeof (ident), "%s,%i,%s", module, instance, name); + *ksp_ptr = kstat_lookup (kc, module, instance, name); if (*ksp_ptr == NULL) { - if ((*ksp_ptr = kstat_lookup (kc, module, instance, name)) == NULL) - { - ERROR ("Cound not find kstat %s", ident); - return (-1); - } + ERROR ("get_kstat: Cound not find kstat %s", ident); + return (-1); + } - if ((*ksp_ptr)->ks_type != KSTAT_TYPE_NAMED) - { - WARNING ("kstat %s has wrong type", ident); - *ksp_ptr = NULL; - return (-1); - } + if ((*ksp_ptr)->ks_type != KSTAT_TYPE_NAMED) + { + ERROR ("get_kstat: kstat %s has wrong type", ident); + *ksp_ptr = NULL; + return (-1); } #ifdef assert @@ -560,13 +560,13 @@ int get_kstat (kstat_t **ksp_ptr, char *module, int instance, char *name) if (kstat_read (kc, *ksp_ptr, NULL) == -1) { - WARNING ("kstat %s could not be read", ident); + ERROR ("get_kstat: kstat %s could not be read", ident); return (-1); } if ((*ksp_ptr)->ks_type != KSTAT_TYPE_NAMED) { - WARNING ("kstat %s has wrong type", ident); + ERROR ("get_kstat: kstat %s has wrong type", ident); return (-1); }