diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-07-19 16:05:23 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-07-19 16:05:23 +0200 |
commit | a09494ac1357b4ec6057c63f4f56890772f548dd (patch) | |
tree | dfa451a6ac1a76d8dbd42dad2f6b7f20680a63fe | |
parent | 7e440acbbf5b74ea8e403dfabd1430a4b26fac81 (diff) | |
parent | 6356763f8e8420d6e0077052636e1bc1ea225d89 (diff) | |
download | rsyslog-a09494ac1357b4ec6057c63f4f56890772f548dd.tar.gz rsyslog-a09494ac1357b4ec6057c63f4f56890772f548dd.tar.bz2 rsyslog-a09494ac1357b4ec6057c63f4f56890772f548dd.zip |
Merge branch 'v7-stable'
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | tests/chkseq.c | 41 |
2 files changed, 41 insertions, 4 deletions
@@ -79,6 +79,10 @@ Version 7.4.3 [v7.4-stable] 2013-07-18 - bugfix: $QHOUR/$HHOUR were always "00" or "01" regression some time between v5 and here Thanks to forum user rjmcinty for reporting this bug +- bugfix: testbench tool chkseq did improperly report invalid file + This happened when permitted duplicate values existed in the very + last lines, right before end-of-file. + Thanks to Radu Gheorghe for reporting this bug. --------------------------------------------------------------------------- Version 7.4.3 [v7.4-stable] 2013-07-18 - bugfix: memory leak if disk queues were used and json data present diff --git a/tests/chkseq.c b/tests/chkseq.c index b22c8992..bea9f83a 100644 --- a/tests/chkseq.c +++ b/tests/chkseq.c @@ -48,6 +48,7 @@ int main(int argc, char *argv[]) int start = 0, end = 0; int opt; int nDups = 0; + int reachedEOF; int edLen; /* length of extra data */ static char edBuf[500*1024]; /* buffer for extra data (pretty large to be on the save side...) */ char *file = NULL; @@ -126,15 +127,47 @@ int main(int argc, char *argv[]) } } - if(nDups != 0) - printf("info: had %d duplicates (this is no error)\n", nDups); - if(i - 1 != end) { printf("only %d records in file, expected %d\n", i - 1, end); exit(1); } - if(!feof(fp)) { + if(feof(fp)) { + reachedEOF = 1; + } else { + /* if duplicates are permitted, we need to do a final check if we have duplicates at the + * end of file. + */ + if(dupsPermitted) { + i = end; + while(!feof(fp)) { + if(bHaveExtraData) { + scanfOK = fscanf(fp, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0; + if(edLen != (int) strlen(edBuf)) { + printf("extra data length specified %d, but actually is %ld in record %d\n", + edLen, (long) strlen(edBuf), i); + exit(1); + } + } else { + scanfOK = fscanf(fp, "%d\n", &val) == 1 ? 1 : 0; + } + + if(val != i) { + reachedEOF = 0; + goto breakIF; + } + } + reachedEOF = feof(fp) ? 1 : 0; + } else { + reachedEOF = 0; + } + } + +breakIF: + if(nDups != 0) + printf("info: had %d duplicates (this is no error)\n", nDups); + + if(!reachedEOF) { printf("end of processing, but NOT end of file!\n"); exit(1); } |