X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fuuid.c;h=4bd43340f61a0100b10233bd61bf5d889706a2bd;hp=1cb902708239e6e5532d1ab46ece44440550eb79;hb=d748379ea585d52338913a6ba589842ae05ab78a;hpb=358bf39b09f69220fc8e1b6c2fe98e5e185e3364 diff --git a/src/uuid.c b/src/uuid.c index 1cb90270..4bd43340 100644 --- a/src/uuid.c +++ b/src/uuid.c @@ -26,10 +26,11 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" -#if HAVE_SYS_SYSCTL_H +#if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTLBYNAME) || defined(__OpenBSD__) +/* Implies have BSD variant */ #include #endif @@ -37,18 +38,15 @@ #define UUID_PRINTABLE_COMPACT_LENGTH (UUID_RAW_LENGTH * 2) #define UUID_PRINTABLE_NORMAL_LENGTH (UUID_PRINTABLE_COMPACT_LENGTH + 4) -static char *uuidfile = NULL; +static char *uuidfile; static const char *config_keys[] = {"UUIDFile"}; static int looks_like_a_uuid(const char *uuid) { - int len; - if (!uuid) return 0; - len = strlen(uuid); - + size_t len = strlen(uuid); if (len < UUID_PRINTABLE_COMPACT_LENGTH) return 0;