[Babel-users] babel freebsd issues

Gabriel Kerneis kerneis at pps.jussieu.fr
Tue Jul 31 06:58:17 UTC 2012


On Tue, Jul 31, 2012 at 12:35:43AM -0400, Antoine Beaupré wrote:
> #1  0x080536f0 in getbool (c=-2, int_r=0xbfbfe540, gnc=Variable "gnc" is not available.) at configuration.c:173

Here, the value of c is in fact -1, but optimisations hide it.  The culprit is
gnc_string which returns -1 in case of error, but every error checking in this
file checks (c < -1) for some reason.

A quick, untested fix should be:

diff --git a/configuration.c b/configuration.c
index 31bcf8f..33605df 100644
--- a/configuration.c
+++ b/configuration.c
@@ -618,7 +618,7 @@ static int
 gnc_string(struct string_state *s)
 {
     if(s->string[s->n] == '\0')
-        return -1;
+        return -2;
     else
         return s->string[s->n++];
 }

A better fix might be to check (c < 0) instead everywhere in config.c.

-- 
Gabriel



More information about the Babel-users mailing list