[Sumover-dev] [svn commit] r3964 - common/trunk/src

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Fri Feb 9 17:23:12 GMT 2007


Author: piers
Date: Fri Feb  9 17:23:16 2007
New Revision: 3964

Modified:
   common/trunk/src/mbus_parser.c

Log:
Rat was crashing due to the following check for errno  at Line 170 mbus_parser.c. However all use of errno should be prefixed with setting it zero as errno is not reset after a successful return from a function. In this case a ERANGE was occurring elsewhere (in tcl code mbus_recv_rtp.source.cname() in ui_audiotool.tcl - not actually a problem because an 'int' compare drops thru to a 'string' compare).

Also note that errno is a global variable in single threaded mode. In multithreaded mode errno is #defined to function that returns the vcalue for the current thread (in Windows this enabled when Multithreaded libraries are selected, in Linux _REENTRANT needs to be defined).

Modified: common/trunk/src/mbus_parser.c
==============================================================================
--- common/trunk/src/mbus_parser.c	(original)
+++ common/trunk/src/mbus_parser.c	Fri Feb  9 17:23:16 2007
@@ -165,10 +165,13 @@
                 m->buffer++;
 		CHECK_OVERRUN;
         }
+	/* Have to set errno to zero before checking for it as strtol/etc doesn't change it if 
+	it is already set */
+	errno = 0;
 
 	*i = (int) strtol(m->buffer, &p, 10);
 	if (errno == ERANGE) {
-		debug_msg("integer out of range: %d\n", *i);
+		debug_msg("integer out of range: %d, mbus:%s\n", *i, m->buffer);
 		abort();
 		return FALSE;
 	}



More information about the Sumover-dev mailing list