X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Futils%2Fcommon%2Fcommon.c;h=0d2aaae6e67cc47e8f0ee05d53d9c06ef80c172b;hp=e986da813ad79d85da3cc5f5def0d18430af95fc;hb=956a2f4996d9fb0526b6f60c29be9b17c0ad27ba;hpb=8f6aa6970bf787e6a11e095322af3338ec781d78 diff --git a/src/utils/common/common.c b/src/utils/common/common.c index e986da81..0d2aaae6 100644 --- a/src/utils/common/common.c +++ b/src/utils/common/common.c @@ -25,7 +25,7 @@ * Niki W. Waibel * Sebastian Harl * Michał Mirosław -**/ + **/ #include "collectd.h" @@ -181,7 +181,7 @@ char *sstrerror(int errnum, char *buf, size_t buflen) { pthread_mutex_unlock(&strerror_r_lock); } -/* #endif !HAVE_STRERROR_R */ + /* #endif !HAVE_STRERROR_R */ #elif STRERROR_R_CHAR_P { @@ -191,17 +191,19 @@ char *sstrerror(int errnum, char *buf, size_t buflen) { if ((temp != NULL) && (temp != buf) && (temp[0] != '\0')) sstrncpy(buf, temp, buflen); else - sstrncpy(buf, "strerror_r did not return " - "an error message", + sstrncpy(buf, + "strerror_r did not return " + "an error message", buflen); } } -/* #endif STRERROR_R_CHAR_P */ + /* #endif STRERROR_R_CHAR_P */ #else if (strerror_r(errnum, buf, buflen) != 0) { - snprintf(buf, buflen, "Error #%i; " - "Additionally, strerror_r failed.", + snprintf(buf, buflen, + "Error #%i; " + "Additionally, strerror_r failed.", errnum); } #endif /* STRERROR_R_CHAR_P */ @@ -737,9 +739,8 @@ long long get_kstat_value(kstat_t *ksp, char *name) { else if (kn->data_type == KSTAT_DATA_UINT32) retval = (long long)kn->value.ui32; else if (kn->data_type == KSTAT_DATA_INT64) - retval = - (long long)kn->value.i64; /* According to ANSI C99 `long long' must hold - at least 64 bits */ + retval = (long long)kn->value.i64; /* According to ANSI C99 `long long' must + hold at least 64 bits */ else if (kn->data_type == KSTAT_DATA_UINT64) retval = (long long)kn->value.ui64; /* XXX: Might overflow! */ else