X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fglobals.c;h=2222a5ce8b9e8f53e69319324219c3a35fa3212d;hb=69a2285dea4568c0010f116d22415f301b74579a;hp=bde7eb222cd58654c85b257329029a2b1676d2e7;hpb=fa56155c34eed72740d375208a63571d5f9d59e0;p=collectd.git diff --git a/src/daemon/globals.c b/src/daemon/globals.c index bde7eb22..2222a5ce 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"), @@ -23,16 +23,27 @@ #include "common.h" #include "globals.h" -#include "plugin.h" + +#if HAVE_KSTAT_H +#include +#endif void hostname_set(char const *hostname) { - sstrncpy(hostname_g, hostname, sizeof(hostname_g)); + char *h = strdup(hostname); + if (h == NULL) + return; + + free(hostname_g); + hostname_g = h; } +/* + * Global variables + */ char *hostname_g; cdtime_t interval_g; -int pidfile_from_cli = 0; int timeout_g; -#if HAVE_LIBKSTAT +#if HAVE_KSTAT_H kstat_ctl_t *kc; -#endif /* HAVE_LIBKSTAT */ +#endif +