CDTIME_T_TO_DOUBLE (plugin_get_interval ()));
setenv ("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1);
CDTIME_T_TO_DOUBLE (plugin_get_interval ()));
setenv ("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1);
- ssnprintf (buffer, sizeof (buffer), "%s", hostname_g);
+ sstrncpy (buffer, hostname_g, sizeof (buffer));
setenv ("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1);
#else
ssnprintf (buffer, sizeof (buffer), "COLLECTD_INTERVAL=%.3f",
setenv ("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1);
#else
ssnprintf (buffer, sizeof (buffer), "COLLECTD_INTERVAL=%.3f",
static int parse_line (char *buffer) /* {{{ */
{
if (strncasecmp ("PUTVAL", buffer, strlen ("PUTVAL")) == 0)
static int parse_line (char *buffer) /* {{{ */
{
if (strncasecmp ("PUTVAL", buffer, strlen ("PUTVAL")) == 0)
else if (strncasecmp ("PUTNOTIF", buffer, strlen ("PUTNOTIF")) == 0)
return (handle_putnotif (stdout, buffer));
else
else if (strncasecmp ("PUTNOTIF", buffer, strlen ("PUTNOTIF")) == 0)
return (handle_putnotif (stdout, buffer));
else
if ((check_capability (CAP_SETUID) != 0) ||
(check_capability (CAP_SETGID) != 0))
{
if (getuid () == 0)
WARNING ("exec plugin: Running collectd as root, but the CAP_SETUID "
"or CAP_SETGID capabilities are missing. The plugin's read function "
if ((check_capability (CAP_SETUID) != 0) ||
(check_capability (CAP_SETGID) != 0))
{
if (getuid () == 0)
WARNING ("exec plugin: Running collectd as root, but the CAP_SETUID "
"or CAP_SETGID capabilities are missing. The plugin's read function "
else
WARNING ("exec plugin: collectd doesn't have the CAP_SETUID or "
"CAP_SETGID capabilities. If you don't want to run collectd as root, "
else
WARNING ("exec plugin: collectd doesn't have the CAP_SETUID or "
"CAP_SETGID capabilities. If you don't want to run collectd as root, "