version 1.1, 2013/10/14 10:32:48
|
version 1.1.1.2, 2014/06/15 20:20:06
|
Line 7
|
Line 7
|
#include "plugin.h" |
#include "plugin.h" |
#include <sys/types.h> |
#include <sys/types.h> |
|
|
|
#include <assert.h> |
#include <fcntl.h> |
#include <fcntl.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <stdio.h> |
#include <stdio.h> |
Line 169 static int mod_rrd_create_pipe(server *srv, plugin_dat
|
Line 170 static int mod_rrd_create_pipe(server *srv, plugin_dat
|
p->read_fd = from_rrdtool_fds[0]; |
p->read_fd = from_rrdtool_fds[0]; |
p->rrdtool_pid = pid; |
p->rrdtool_pid = pid; |
|
|
#ifdef FD_CLOEXEC | fd_close_on_exec(p->write_fd); |
fcntl(p->write_fd, F_SETFD, FD_CLOEXEC); | fd_close_on_exec(p->read_fd); |
fcntl(p->read_fd, F_SETFD, FD_CLOEXEC); | |
#endif | |
|
|
break; |
break; |
} |
} |
Line 345 SETDEFAULTS_FUNC(mod_rrd_set_defaults) {
|
Line 344 SETDEFAULTS_FUNC(mod_rrd_set_defaults) {
|
|
|
if (!p) return HANDLER_ERROR; |
if (!p) return HANDLER_ERROR; |
|
|
p->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *)); | force_assert(srv->config_context->used > 0); |
| p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); |
|
|
for (i = 0; i < srv->config_context->used; i++) { |
for (i = 0; i < srv->config_context->used; i++) { |
plugin_config *s; |
plugin_config *s; |
Line 435 TRIGGER_FUNC(mod_rrd_trigger) {
|
Line 435 TRIGGER_FUNC(mod_rrd_trigger) {
|
} |
} |
|
|
buffer_prepare_copy(p->resp, 4096); |
buffer_prepare_copy(p->resp, 4096); |
if (-1 == (r = safe_read(p->read_fd, p->resp->ptr, p->resp->size))) { | if (-1 == (r = safe_read(p->read_fd, p->resp->ptr, p->resp->size - 1))) { |
p->rrdtool_running = 0; |
p->rrdtool_running = 0; |
|
|
log_error_write(srv, __FILE__, __LINE__, "ss", |
log_error_write(srv, __FILE__, __LINE__, "ss", |
Line 444 TRIGGER_FUNC(mod_rrd_trigger) {
|
Line 444 TRIGGER_FUNC(mod_rrd_trigger) {
|
return HANDLER_ERROR; |
return HANDLER_ERROR; |
} |
} |
|
|
p->resp->used = r; | p->resp->used = r + 1; |
| p->resp->ptr[r] = '\0'; |
|
|
if (p->resp->ptr[0] != 'O' || |
if (p->resp->ptr[0] != 'O' || |
p->resp->ptr[1] != 'K') { |
p->resp->ptr[1] != 'K') { |