I have found a bug on net-snmp 5.2.1.

On my debian, it's work very fine.

But on a special Linux (Pitux distribution (glib-1.2.6-3 glibc-2.3.2-4.80.8tbs )), it's failed.

It's return always the same value, sometime 0.

I think it's a problem with value return of fseek.


** Modification I have made and work (faster when file don't change) :


Before:
-----------------------------------------------------------------
    / * ------------------------------------
     * now the pointer and the counter are
     * set either zero or reset to old
     * value; now let's try to read some
     * data
     * ------------------------------------
     */

    if (stat(logmatchTable[iindex].filename, &sb) == 0) {

        if (logmatchTable[iindex].currentFilePosition > sb.st_size) {
            toobig = TRUE;
        } else {
            toobig = FALSE;
        }


        if( (logmatchTable[iindex].logfile =
            fopen(logmatchTable[iindex].filename, "r"))) {

        .....



After :
------------------------------------------------------------------------
    / * ------------------------------------
     * now the pointer and the counter are
     * set either zero or reset to old
     * value; now let's try to read some
     * data
     * ------------------------------------
     */

    if (stat(logmatchTable[iindex].filename, &sb) == 0) {

        if (logmatchTable[iindex].currentFilePosition > sb.st_size) {
            toobig = TRUE;
        } else {
            toobig = FALSE;
        }

        /// Add this
        if( sb.st_size == logmatchTable[iindex].currentFilePosition )
                logmatchTable[iindex].currentMatchCounter = 0;


        /// Add ( sb.st_size != logmatchTabl .. && )
if( ( sb.st_size != logmatchTable[iindex].currentFilePosition) && (logmatchTable[iindex].logfile =
            fopen(logmatchTable[iindex].filename, "r"))) {


        ....

------------------------------------------------------------


It's a problem of glib(c) the difference of fseek use?

         bye bye.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to