From 68215bd134573588e4f99558ff59640470c90faa Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 7 Aug 2010 09:48:16 +0200 Subject: [PATCH] collectd-flush: Determine default socket from configured localstatedir. --- src/collectd-flush.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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; -- 2.11.0