diff options
author | Ben Pfaff <blp@nicira.com> | 2013-07-08 10:15:00 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-07-08 10:15:00 -0700 |
commit | bdda5aca7b376bcc8c88072d00011a9da04af65c (patch) | |
tree | 1422bc448e2a094e0d1e988d29e7fe30600f13eb /tests/test-bundle.c | |
parent | 5ed2d819bb27cd8d899ed060460c8a28b481cf2f (diff) | |
download | openvswitch-bdda5aca7b376bcc8c88072d00011a9da04af65c.tar.gz |
ofp-parse: Do not exit() upon a parse error.
Until now, failure to parse a flow in the ofp-parse module has caused the
program to abort immediately with a fatal error. This makes it hard to
use these functions from any long-lived program. This commit fixes the
problem.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'tests/test-bundle.c')
-rw-r--r-- | tests/test-bundle.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/test-bundle.c b/tests/test-bundle.c index 0e7525c38..41e2e38e1 100644 --- a/tests/test-bundle.c +++ b/tests/test-bundle.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2012 Nicira, Inc. +/* Copyright (c) 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,9 +71,14 @@ parse_bundle_actions(char *actions) struct ofpact_bundle *bundle; struct ofpbuf ofpacts; struct ofpact *action; + char *error; ofpbuf_init(&ofpacts, 0); - bundle_parse_load(actions, &ofpacts); + error = bundle_parse_load(actions, &ofpacts); + if (error) { + ovs_fatal(0, "%s", error); + } + action = ofpacts.data; bundle = ofpact_get_BUNDLE(xmemdup(action, action->len)); ofpbuf_uninit(&ofpacts); |