summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'daemon')
-rw-r--r--daemon/Makefile.am2
-rw-r--r--daemon/config.c7
-rw-r--r--daemon/rrd-update.c4
-rw-r--r--daemon/rrdbotd.c14
-rw-r--r--daemon/snmp-engine.c5
5 files changed, 23 insertions, 9 deletions
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index dda6ceb..466353b 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -1,7 +1,7 @@
sbin_PROGRAMS = rrdbotd
-rrdbotd_SOURCES = rrdbotd.c rrdbotd.h config.c usuals.h \
+rrdbotd_SOURCES = rrdbotd.c rrdbotd.h config.c \
snmp-help.c snmp-engine.c rrd-update.c \
../common/server-mainloop.c ../common/server-mainloop.h \
../common/sock-any.h ../common/sock-any.c \
diff --git a/daemon/config.c b/daemon/config.c
index 8c20c4a..ce6e397 100644
--- a/daemon/config.c
+++ b/daemon/config.c
@@ -42,8 +42,10 @@
#include <syslog.h>
#include <dirent.h>
#include <string.h>
+#include <err.h>
#include "rrdbotd.h"
+#include "config-parser.h"
/*
* These routines parse the configuration files and setup the in memory
@@ -279,7 +281,7 @@ parse_item(const char* field, char* uri, config_ctx *ctx)
{
rb_message(LOG_WARNING, "couldn't resolve host address (ignoring): %s", host);
free(rhost);
- return;
+ return NULL;
}
/* And add it to the list */
@@ -305,6 +307,8 @@ parse_item(const char* field, char* uri, config_ctx *ctx)
/* And add it to the list */
ritem->next = ctx->items;
ctx->items = ritem;
+
+ return ritem;
}
static void
@@ -349,7 +353,6 @@ config_value(const char* header, const char* name, char* value,
/* If it starts with "field." */
else if(strncmp(name, CONFIG_FIELD, KL(CONFIG_FIELD)) == 0)
{
- rb_poller* poll;
const char* field;
const char* t;
diff --git a/daemon/rrd-update.c b/daemon/rrd-update.c
index 295eea6..ca8d71b 100644
--- a/daemon/rrd-update.c
+++ b/daemon/rrd-update.c
@@ -43,6 +43,8 @@
#include <syslog.h>
#include <unistd.h>
+#include <rrd.h>
+
#include "rrdbotd.h"
#define MAX_NUMLEN 40
@@ -120,7 +122,7 @@ void rb_rrd_update(rb_poller *poll)
rb_messagex(LOG_DEBUG, "> values: %s", items);
rrd_clear_error();
- r = rrd_update(5, argv);
+ r = rrd_update(5, (char**)argv);
if(r != 0)
rb_messagex(LOG_ERR, "couldn't update rrd file: %s: %s",
diff --git a/daemon/rrdbotd.c b/daemon/rrdbotd.c
index c28825d..261955d 100644
--- a/daemon/rrdbotd.c
+++ b/daemon/rrdbotd.c
@@ -42,11 +42,13 @@
#include <stdarg.h>
#include <syslog.h>
#include <signal.h>
+#include <err.h>
#include <bsnmp/asn1.h>
#include <bsnmp/snmp.h>
#include "rrdbotd.h"
+#include "server-mainloop.h"
/* The default command line options */
#define DEFAULT_CONFIG CONF_PREFIX "/rrdbot"
@@ -72,11 +74,12 @@ static int debug_level = LOG_ERR;
#include "mib/parse.h"
+#ifdef TEST
+
static void
test(int argc, char* argv[])
{
struct snmp_value val;
- mib_node n, n2;
debug_level = 4;
@@ -98,6 +101,8 @@ test(int argc, char* argv[])
exit(1);
}
+#endif /* TEST */
+
/* -----------------------------------------------------------------------------
* LOGGING
*/
@@ -211,7 +216,10 @@ main(int argc, char* argv[])
char ch;
char* t;
- /* test(argc, argv); */
+#ifdef TEST
+ test(argc, argv);
+ return 1;
+#endif
/* Initialize the state stuff */
memset(&g_state, 0, sizeof(g_state));
@@ -310,7 +318,7 @@ main(int argc, char* argv[])
{
/* Fork a daemon nicely */
if(daemon(0, 0) == -1)
- err("couldn't fork as a daemon");
+ err(1, "couldn't fork as a daemon");
rb_messagex(LOG_DEBUG, "running as a daemon");
daemonized = 1;
diff --git a/daemon/snmp-engine.c b/daemon/snmp-engine.c
index 66cc047..37637ab 100644
--- a/daemon/snmp-engine.c
+++ b/daemon/snmp-engine.c
@@ -38,7 +38,9 @@
#include "usuals.h"
#include <errno.h>
+#include <unistd.h>
#include <syslog.h>
+#include <err.h>
#include <bsnmp/asn1.h>
#include <bsnmp/snmp.h>
@@ -121,7 +123,7 @@ new_req()
{
rb_request* req = NULL;
uint num;
- int i, first, overlap = 0;
+ int i, overlap = 0;
if(nrequests)
{
@@ -335,7 +337,6 @@ respond_req(rb_request* req, struct snmp_pdu* pdu, mstime when)
struct snmp_value* value;
rb_poller* poll = req->poll;
rb_item* item;
- int incomplete = 0;
int i;
ASSERT(req->id == pdu->request_id);