[collectd] [PATCH] unixsock plugin: Set default path of the UNIX socket to $localstatedir.

Sebastian Harl sh at tokkee.org
Tue Jun 12 18:47:53 CEST 2007


For this purpose LOCALSTATEDIR is defined to $localstatedir during
compilation.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/Makefile.am |    3 ++-
 src/collectd.h  |    4 ++++
 src/unixsock.c  |    2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 1007dbc..f7168a9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,7 @@ collectd_SOURCES = collectd.c collectd.h \
 collectd_CPPFLAGS = $(LTDLINCL)
 collectd_CPPFLAGS += -DPREFIX='"${prefix}"'
 collectd_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"'
+collectd_CPPFLAGS += -DLOCALSTATEDIR='"${localstatedir}"'
 collectd_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"'
 if BUILD_FEATURE_DAEMON
 collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
@@ -527,7 +528,7 @@ endif
 if BUILD_MODULE_UNIXSOCK
 pkglib_LTLIBRARIES += unixsock.la
 unixsock_la_SOURCES = unixsock.c
-unixsock_la_CPPFLAGS = -DPREFIX='"${prefix}"'
+unixsock_la_CPPFLAGS = -DLOCALSTATEDIR='"${localstatedir}"'
 unixsock_la_LDFLAGS = -module -avoid-version -lpthread
 collectd_LDADD += "-dlopen" unixsock.la
 collectd_DEPENDENCIES += unixsock.la
diff --git a/src/collectd.h b/src/collectd.h
index ac75516..282e632 100644
--- a/src/collectd.h
+++ b/src/collectd.h
@@ -182,6 +182,10 @@
 #define CONFIGFILE SYSCONFDIR"/collectd.conf"
 #endif
 
+#ifndef LOCALSTATEDIR
+#define LOCALSTATEDIR PREFIX "/var"
+#endif
+
 #ifndef PKGLOCALSTATEDIR
 #define PKGLOCALSTATEDIR PREFIX "/var/lib/" PACKAGE_NAME
 #endif
diff --git a/src/unixsock.c b/src/unixsock.c
index 215abdd..6302b17 100644
--- a/src/unixsock.c
+++ b/src/unixsock.c
@@ -36,7 +36,7 @@
 # define UNIX_PATH_MAX sizeof (((struct sockaddr_un *)0)->sun_path)
 #endif
 
-#define US_DEFAULT_PATH PREFIX"/var/run/"PACKAGE_NAME"-unixsock"
+#define US_DEFAULT_PATH LOCALSTATEDIR"/run/"PACKAGE_NAME"-unixsock"
 
 /*
  * Private data structures
-- 
1.5.1.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20070612/f7701af8/attachment.pgp 


More information about the collectd mailing list