From: Ben Pfaff Date: Fri, 27 Apr 2012 16:41:02 +0000 (-0700) Subject: ofp-util: Avoid ovs_fatal() in ofputil_parse_key_value(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33cadc5034cda0c9a0bcd59fbec146784387ee1f;p=openvswitch ofp-util: Avoid ovs_fatal() in ofputil_parse_key_value(). ofputil_parse_key_value() is safe to use from a process that must not abort except in one case: where the argument contains unbalanced parentheses. This commit eliminates that call to ovs_fatal(), instead just treating the end of the string as closing all nested parentheses. It would be better to propagate the error condition upward, but I'm not sure that it's worth it just for this one corner case. The purpose of this commit is to make it possible to use this function indirectly within the "ofproto/trace" implementation, which must never abort ovs-vswitchd. (All the current callers are within ovs-ofctl and other utilities.) Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 43776d58..0fadadd4 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -3926,7 +3926,8 @@ ofputil_parse_key_value(char **stringp, char **keyp, char **valuep) for (value_len = 0; level > 0; value_len++) { switch (value[value_len]) { case '\0': - ovs_fatal(0, "unbalanced parentheses in argument to %s", key); + level = 0; + break; case '(': level++;