X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcommon.c;h=0bd9f68fe84a751c339cc9b652c0587d9aa7273b;hb=081937982256f1f1ecbcff36a76422b05058a832;hp=459c7024bb2bcb9824c0c131d5ea10a9e50845d4;hpb=ab55c79a0fee35932995d9f492730dc131034d52;p=collectd.git diff --git a/src/common.c b/src/common.c index 459c7024..0bd9f68f 100644 --- a/src/common.c +++ b/src/common.c @@ -548,7 +548,7 @@ int check_create_dir (const char *file_orig) { if (errno == ENOENT) { - if (mkdir (dir, 0755) == 0) + if (mkdir (dir, S_IRWXU | S_IRWXG | S_IRWXO) == 0) break; /* this might happen, if a different thread created @@ -636,24 +636,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;