[Swan-dev] libreswan-3.5/lib/libswan/subnettot.c:29: possible bad if test ?

David Binderman dcb314 at hotmail.com
Wed Oct 23 19:14:20 EEST 2013


Hello there,

I just compile libreswan-3.5 with the extra compiler flag -Wlogical-op

It said

/home/dcb/rpmbuild/BUILD/libreswan-3.5/lib/libswan/subnettot.c:29:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
/home/dcb/rpmbuild/BUILD/libreswan-3.5/lib/libswan/subnettot.c:35:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]

Source code is

    case AF_INET:
        if (sub->maskbits <= 0 && sub->maskbits> 32)
            return FALSE;

        break;

    case AF_INET6:
        if (sub->maskbits <= 0 && sub->maskbits> 128)
            return FALSE;

        break;

Suggest swap && for ||

Regards

David Binderman 		 	   		  


More information about the Swan-dev mailing list