#endif
])
AC_CHECK_HEADERS(sys/un.h)
+AC_CHECK_HEADERS(grp.h)
# For debugging interface (variable number of arguments)
AC_CHECK_HEADERS(stdarg.h)
#define MODE_LOCAL 0x04
#define MODE_LOG 0x08
+#ifndef COLLECTD_GRP_NAME
+# define COLLECTD_GRP_NAME "collectd"
+#endif
+
#ifndef COLLECTD_STEP
# define COLLECTD_STEP "10"
#endif
# include <sys/un.h>
#endif /* HAVE_LINUX_UN_H | HAVE_SYS_UN_H */
+#if HAVE_GRP_H
+# include <grp.h>
+#endif /* HAVE_GRP_H */
+
#define MODULE_NAME "email"
/* 256 bytes ought to be enough for anybody ;-) */
pthread_exit ((void *)1);
}
+ if ((uid_t)0 == geteuid ()) {
+ struct group *grp;
+
+ errno = 0;
+ if (NULL != (grp = getgrnam (COLLECTD_GRP_NAME))) {
+ errno = 0;
+ if (0 != chown (SOCK_PATH, (uid_t)-1, grp->gr_gid)) {
+ syslog (LOG_WARNING, "chown() failed: %s", strerror (errno));
+ }
+ }
+ else {
+ syslog (LOG_WARNING, "getgrnam() failed: %s", strerror (errno));
+ }
+ }
+ else {
+ syslog (LOG_WARNING, "not running as root");
+ }
+
+ errno = 0;
+ if (0 != chmod (SOCK_PATH, S_IRWXU | S_IRWXG)) {
+ syslog (LOG_WARNING, "chmod() failed: %s", strerror (errno));
+ }
+
{ /* initialize queue of available threads */
int i = 0;