[Opendnssec-develop] Bug in logging.c ?

Marco Davids marco.davids at sidn.nl
Wed Jan 27 11:06:42 UTC 2010


Hi there,

It seems to me that there is a bug in the 'facility2int' function in
logging.c.

    else if (strncmp(dup, "LOCAL0", 6) && strlen(dup) == 6)
        *fac = LOG_LOCAL0;

and all the other ones in that same statement seem to have the wrong
effect. When 'dup' is 'LOCAL0', the return value of strncmp is zero,
hence the if-statement will fail, where it was suppose to be succesful,

How about this?

    else if (strncmp(dup, "LOCAL0", 6) == 0 && strlen(dup) == 6)
        *fac = LOG_LOCAL0;

Or

    else if (! strncmp(dup, "LOCAL0", 6) && strlen(dup) == 6)
        *fac = LOG_LOCAL0;

Cheers,

--
Marco Davids
SIDN





More information about the Opendnssec-develop mailing list