X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fglobals.c;h=54092942aa93823dcdd9fa83c6f7c3f597c429d9;hb=54d4f889eb72249824ef4ee6b155b0e0fb858be2;hp=bde7eb222cd58654c85b257329029a2b1676d2e7;hpb=fa56155c34eed72740d375208a63571d5f9d59e0;p=collectd.git diff --git a/src/daemon/globals.c b/src/daemon/globals.c index bde7eb22..54092942 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,18 +21,28 @@ * DEALINGS IN THE SOFTWARE. **/ -#include "common.h" +#include "utils/common/common.h" #include "globals.h" -#include "plugin.h" -void hostname_set(char const *hostname) { - sstrncpy(hostname_g, hostname, sizeof(hostname_g)); -} +#if HAVE_KSTAT_H +#include +#endif +/* + * Global variables + */ char *hostname_g; cdtime_t interval_g; -int pidfile_from_cli = 0; -int timeout_g; -#if HAVE_LIBKSTAT +int timeout_g; +#if HAVE_KSTAT_H kstat_ctl_t *kc; -#endif /* HAVE_LIBKSTAT */ +#endif + +void hostname_set(char const *hostname) { + char *h = strdup(hostname); + if (h == NULL) + return; + + sfree(hostname_g); + hostname_g = h; +}