X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fglobals.c;h=a76a44c4f0080e9e2e5e791fbc377d419bd97de1;hb=c4439c9cb3e2348ad7013644731de27a55eca478;hp=652ff06dad8fdd271881149c75b7b2005d0f60cc;hpb=7381780b0bec2dd004324aebcb50262f12a2b44d;p=collectd.git diff --git a/src/daemon/globals.c b/src/daemon/globals.c index 652ff06d..a76a44c4 100644 --- a/src/daemon/globals.c +++ b/src/daemon/globals.c @@ -1,6 +1,6 @@ /** * collectd - src/globals.c - * Copyright (C) 2017 Florian octo Forster + * Copyright (C) 2017 Google LLC * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -21,24 +21,28 @@ * DEALINGS IN THE SOFTWARE. **/ -#include "common.h" #include "globals.h" +#include "utils/common/common.h" #if HAVE_KSTAT_H #include #endif -void hostname_set(char const *hostname) { - sstrncpy(hostname_g, hostname, sizeof(hostname_g)); -} - /* * Global variables */ char *hostname_g; cdtime_t interval_g; -int timeout_g; +int timeout_g; #if HAVE_KSTAT_H kstat_ctl_t *kc; #endif +void hostname_set(char const *hostname) { + char *h = strdup(hostname); + if (h == NULL) + return; + + sfree(hostname_g); + hostname_g = h; +}