Skip to content
This repository
Browse code

Completly fix ISSUE9

  • Loading branch information...
commit 156cfa9815fbf978e73cbd58d532371909e22b5e 1 parent f71a8d3
Eric Lauzon authored December 11, 2011

Showing 1 changed file with 18 additions and 2 deletions. Show diff stats Hide diff stats

  1. 20  src/spooler.c
20  src/spooler.c
@@ -381,6 +381,9 @@ int ProcessContinuous(const char *dirpath, const char *filebase,
381 381
     uint32_t            skipped = 0;
382 382
     uint32_t            extension = 0;
383 383
 
  384
+    u_int32_t waldo_timestamp = 0;
  385
+    waldo_timestamp = timestamp; /* fix possible bug by keeping invocated timestamp at the time of the initial call */
  386
+    
384 387
     if (BcProcessNewRecordsOnly())
385 388
     {
386 389
         LogMessage("Processing new records only.\n");
@@ -407,6 +410,15 @@ int ProcessContinuous(const char *dirpath, const char *filebase,
407 410
             /* find the next file to spool */
408 411
             ret = FindNextExtension(dirpath, filebase, timestamp, &extension);
409 412
 
  413
+	    /* The file found is not the same as specified in the waldo,
  414
+               thus we need to reset record_start, since we are obviously not processing the same file*/
  415
+            if(waldo_timestamp != extension)
  416
+            {
  417
+                record_start = 0; /* There is no danger to resetting record_start to 0
  418
+                                     if called timestamp is not the same */
  419
+            }
  420
+
  421
+
410 422
             /* no new extensions found */
411 423
             if (ret == SPOOLER_EXTENSION_NONE)
412 424
             {
@@ -431,7 +443,7 @@ int ProcessContinuous(const char *dirpath, const char *filebase,
431 443
                 pc_ret = -1;
432 444
                 continue;
433 445
             }
434  
-
  446
+	    
435 447
             /* found a new extension so create a new spooler */
436 448
             if ( (spooler=spoolerOpen(dirpath, filebase, extension)) == NULL )
437 449
             {
@@ -440,7 +452,11 @@ int ProcessContinuous(const char *dirpath, const char *filebase,
440 452
                 pc_ret = -1;
441 453
                 continue;
442 454
             }
443  
-
  455
+	    
  456
+            /* Make sure we create a new waldo even if we did not have processed an event */
  457
+            spooler->record_idx = 0;
  458
+            spoolerWriteWaldo(&barnyard2_conf->waldo, spooler);
  459
+	    
444 460
             waiting_logged = 0;
445 461
 
446 462
             /* set timestamp to ensure we look for a newer file next time */

0 notes on commit 156cfa9

Please sign in to comment.
Something went wrong with that request. Please try again.