X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fuuid.c;h=c7878c74dd54a7836bfdc08329e0ae77ab6aa639;hp=4846841bb5cc7718b5221f443a0888580007efd8;hb=7c9d772c992647fcba64a96800c146eb9f1647f8;hpb=196f5bd17880d91ba0da33a8f5f6168d039cfa0c diff --git a/src/uuid.c b/src/uuid.c index 4846841b..c7878c74 100644 --- a/src/uuid.c +++ b/src/uuid.c @@ -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; }