freebsd-ports/net-mgmt/rrdbot/files/patch-parse.c
Jeremy Chadwick 63e4fa118f RRDBot is an SNMP polling daemon which writes the polled values to an RRD
database. It can poll many different SNMP sources in an efficient manner.

It has no large external dependencies, and its configuration is stored in text
files. It has full support for MIB definition files and using textual MIBs
instead of numerical OIDs.

A nice feature is the querying of SNMP tables without using a specific index.
Indexes of the rows in an SNMP table may change from time to time, and are less
than ideal for long term tracking of a given value. For example RRDBot can
query the traffic on your router based on the 'xl0' interface name.

RRDBot also contains tools to simplify the creation of RRD files, and the
various archives contained in them.
2008-09-23 02:02:16 +00:00

43 lines
1.4 KiB
C

--- mib/parse.c.orig 2007-05-26 17:42:33.000000000 -0700
+++ mib/parse.c 2008-09-18 10:42:58.000000000 -0700
@@ -4516,20 +4516,17 @@
int
add_mibdir(const char *dirname)
{
- FILE *fp, *ip;
+ FILE *fp;
DIR *dir, *dir2;
const char *oldFile = File;
struct dirent *file;
char token[MAXTOKEN], token2[MAXTOKEN];
- char tmpstr[300];
+ char tmpstr[MAXPATHLEN];
int count = 0;
DEBUGMSGTL(("parse-mibs", "Scanning directory %s\n", dirname));
if ((dir = opendir(dirname))) {
- snprintf(tmpstr, sizeof(tmpstr), "%s/.index", dirname);
- tmpstr[ sizeof(tmpstr)-1 ] = 0;
- ip = fopen(tmpstr, "w");
while ((file = readdir(dir))) {
/*
* Only parse file names not beginning with a '.'
@@ -4561,8 +4558,6 @@
if (get_token(fp, token2, MAXTOKEN) == DEFINITIONS) {
new_module(token, tmpstr);
count++;
- if (ip)
- fprintf(ip, "%s %s\n", token, file->d_name);
}
fclose(fp);
}
@@ -4570,8 +4565,6 @@
}
File = oldFile;
closedir(dir);
- if (ip)
- fclose(ip);
return (count);
}
return (-1);