Fix compile time issues
[collectd.git] / src / uuid.c
index 4846841..60d09b5 100644 (file)
@@ -26,8 +26,8 @@
 
 #include "collectd.h"
 
-#include "common.h"
 #include "plugin.h"
+#include "utils/common/common.h"
 
 #if HAVE_SYS_SYSCTL_H
 #include <sys/sysctl.h>
 #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;
   }