Record Counting Bug

Nick Diel nick at engineerity.com
Sat Aug 29 15:14:39 EDT 2009


This bug may affect other things, but in racount the record count is always
1 higher than it should be.  I actually dug into the source code here (note
I am not a progammer by day or night, so take it all with a grain of salt).
I found in the argus_main.c file it incremented total records by one every
time a file is read.  I think it is as simple as removing this line since
the counting actually happens in the argus_util.c file.  Also right next to
it we are incrementing ArgusTotalMarRecords, I am not sure what this is, but
perhaps that shouldn't be there too.  Then this increment for these two
items happens for stdin and remote connections, so probably should be
removed too.  Here is what I think the patch file should be:

--- origs/argus_main.c  2009-08-29 11:35:50.000000000 -0600
+++ common/argus_main.c 2009-08-29 13:10:42.000000000 -0600
@@ -216,8 +216,6 @@
                   }

                   if ((file->file != NULL) && ((ArgusReadConnection
(ArgusParser, file, ARGUS_FILE)) >= 0)) {
-                     ArgusParser->ArgusTotalMarRecords++;
-                     ArgusParser->ArgusTotalRecords++;

                      if (ArgusParser->RaPollMode) {
                          ArgusHandleDatum (ArgusParser, file,
&file->ArgusInitCon, &ArgusParser->ArgusFilterCode);
@@ -246,8 +244,6 @@
                file->ostop = -1;

                if (((ArgusReadConnection (ArgusParser, file, ARGUS_FILE))
>= 0)) {
-                  ArgusParser->ArgusTotalMarRecords++;
-                  ArgusParser->ArgusTotalRecords++;

                   if ((flags = fcntl(fileno(stdin), F_GETFL, 0L)) < 0)
                      ArgusLog (LOG_ERR, "ArgusConnectRemote: fcntl error
%s", strerror(errno));
@@ -309,8 +305,6 @@
             while ((addr = (void
*)ArgusPopQueue(ArgusParser->ArgusRemoteHosts, ARGUS_LOCK)) != NULL) {
                if ((addr->fd = ArgusGetServerSocket (addr, 5)) >= 0) {
                   if ((ArgusReadConnection (ArgusParser, addr,
ARGUS_SOCKET)) >= 0) {
-                     ArgusParser->ArgusTotalMarRecords++;
-                     ArgusParser->ArgusTotalRecords++;

                      if ((flags = fcntl(addr->fd, F_GETFL, 0L)) < 0)
                         ArgusLog (LOG_ERR, "ArgusConnectRemote: fcntl error
%s", strerror(errno));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist1.pair.net/pipermail/argus/attachments/20090829/b676d2d6/attachment.html>


More information about the argus mailing list