X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fuuid.c;h=60d09b513c32d7a960c7990eef43dfeabc02f245;hp=4846841bb5cc7718b5221f443a0888580007efd8;hb=54619dc85fd308b21ed09a0271e5c7383c7921b9;hpb=307c875e5a78a2729fbbe1a588d232e9a129d75a diff --git a/src/uuid.c b/src/uuid.c index 4846841b..60d09b51 100644 --- a/src/uuid.c +++ b/src/uuid.c @@ -26,8 +26,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #if HAVE_SYS_SYSCTL_H #include @@ -37,18 +37,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; @@ -193,7 +190,7 @@ static int uuid_init(void) { char *uuid = uuid_get_local(); if (uuid) { - sstrncpy(hostname_g, uuid, DATA_MAX_NAME_LEN); + hostname_set(uuid); sfree(uuid); return 0; }