Probable error in xpp/mpptalk.c with logical negation operator

Bruno Wolff III bruno at wolff.to
Sun Jun 14 14:21:50 CDT 2015


The following line in xpp/mpptalk.c was flagged by gcc in Fedora Rawhide:
	if(!astribank->burn_state == BURN_STATE_STARTED) {

This did seem to be incorrect, though maybe worked in practice. For Fedora 
I changed it to:
	if(astribank->burn_state != BURN_STATE_STARTED) {
which appear to match the intent of the test.

The actual patch is attached.
-------------- next part --------------
--- xpp/mpptalk.c.orig	2015-06-14 13:55:45.798544133 -0500
+++ xpp/mpptalk.c	2015-06-14 13:56:14.401179381 -0500
@@ -512,7 +512,7 @@
 
 	assert(astribank != NULL);
 	xtalk_dev = astribank->xtalk_dev;
-	if(!astribank->burn_state == BURN_STATE_STARTED) {
+	if(astribank->burn_state != BURN_STATE_STARTED) {
 		ERR("Tried to send a segment while burn_state=%d\n",
 				astribank->burn_state);
 		return -EINVAL;


More information about the dahdi-dev mailing list