From: Sebastian Harl Date: Sat, 7 Aug 2010 07:48:16 +0000 (+0200) Subject: collectd-flush: Determine default socket from configured localstatedir. X-Git-Tag: collectd-5.0.0-beta0~70 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=68215bd134573588e4f99558ff59640470c90faa;p=collectd.git collectd-flush: Determine default socket from configured localstatedir. --- diff --git a/src/collectd-flush.c b/src/collectd-flush.c index 7b9326bf..38699914 100644 --- a/src/collectd-flush.c +++ b/src/collectd-flush.c @@ -19,6 +19,12 @@ * HÃ¥kon J Dugstad Johnsen **/ +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include "libcollectdclient/client.h" + #include #include #include @@ -26,7 +32,7 @@ #include #include -#include "libcollectdclient/client.h" +#define DEFAULT_SOCK LOCALSTATEDIR"/run/"PACKAGE_NAME"-unixsock" extern char *optarg; @@ -85,7 +91,7 @@ static void exit_usage (const char *name, int status) { "Available options:\n" " -s Path to collectd's UNIX socket.\n" - " Default: /var/run/collectd-unixsock\n" + " Default: "DEFAULT_SOCK"\n" " -p Plugin to be flushed.\n" " -i Flush data identified by only (see below).\n" " -t Flush values older than this value only.\n" @@ -128,7 +134,7 @@ static int charoccurences (const char *str, char chr) { } int main (int argc, char **argv) { - char address[1024] = "unix:/var/run/collectd-unixsock"; + char address[1024] = "unix:"DEFAULT_SOCK; char *plugin = NULL; char ident_str[1024] = ""; int timeout = -1;