]> granicus.if.org Git - graphviz/commitdiff
Fix mapBool to return the default if we fall into the atoi() case but the
authorerg <devnull@localhost>
Wed, 25 Aug 2010 21:13:36 +0000 (21:13 +0000)
committererg <devnull@localhost>
Wed, 25 Aug 2010 21:13:36 +0000 (21:13 +0000)
string does not start with a digit.

lib/common/utils.c

index d19e4d4f906c7cc5a52b8e074ab9650bc1f3aca8..7cfdbc37e2cd0c4b2064213b50834991d3963fed 100644 (file)
@@ -436,8 +436,10 @@ boolean mapBool(char *p, boolean dflt)
        return TRUE;
     if (!strcasecmp(p, "yes"))
        return TRUE;
-    return atoi(p);
-    
+    if (isdigit(*p))
+       return atoi(p);
+    else
+       return dflt;
 }
 
 boolean mapbool(char *p)