#39 BandwidthD complains invalid log file on valid log file

open
nobody
None
5
2008-07-15
2008-07-15
tigerdaisy
No

BandwidthD complains about log file corruption, on a log file it has just generated, and looks perfectly valid.

Discussion

  • tigerdaisy
    tigerdaisy
    2008-07-15

    log file

     
    Attachments
  • Hmm, this project seems kind of dead, but I've run into the same bug.

    The problem is a pair of fscanf calls that expects the wrong number of fields. Here's a quick diff that fixes this bug:

    --- bandwidthd-2.0.1+cvs20090917.orig/bandwidthd.c
    +++ bandwidthd-2.0.1+cvs20090917/bandwidthd.c
    @@ -1192,10 +1192,10 @@

    if (fscanf(cdf, "%llu,%llu,%llu,%llu,%llu,%llu,%llu,%llu,",
    &ip->Send.total, &ip->Send.icmp, &ip->Send.udp,
    - &ip->Send.tcp, &ip->Send.ftp, &ip->Send.http, &ip->Send.mail, &ip->Send.p2p) != 7
    + &ip->Send.tcp, &ip->Send.ftp, &ip->Send.http, &ip->Send.mail, &ip->Send.p2p) != 8
    || fscanf(cdf, "%llu,%llu,%llu,%llu,%llu,%llu,%llu,%llu",
    &ip->Receive.total, &ip->Receive.icmp, &ip->Receive.udp,
    - &ip->Receive.tcp, &ip->Receive.ftp, &ip->Receive.http, &ip->Receive.mail, &ip->Receive.p2p) != 7)
    + &ip->Receive.tcp, &ip->Receive.ftp, &ip->Receive.http, &ip->Receive.mail, &ip->Receive.p2p) != 8)
    goto End_RecoverDataFromCdf;
    }