From 110d69af04a250cc2560644edd65a27158fa45e3 Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Sat, 1 Aug 2009 01:03:23 -0700 Subject: [PATCH] vswitchd: Initialize cfg properly and check return values A previous checkin added the cfg_init() function, so we now call it. We also check the return value of the initial call to cfg_read(), since if it fails, there's not much point in continuing. --- utilities/ovs-cfg-mod.c | 1 + vswitchd/ovs-brcompatd.c | 6 +++++- vswitchd/ovs-vswitchd.c | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/utilities/ovs-cfg-mod.c b/utilities/ovs-cfg-mod.c index df942f5b..1b52a7bc 100644 --- a/utilities/ovs-cfg-mod.c +++ b/utilities/ovs-cfg-mod.c @@ -60,6 +60,7 @@ open_config(char *config_file, int timeout) { int error; + cfg_init(); error = cfg_set_file(config_file); if (error) { ovs_fatal(error, "failed to add configuration file \"%s\"", diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c index 2384f5ca..9254c588 100644 --- a/vswitchd/ovs-brcompatd.c +++ b/vswitchd/ovs-brcompatd.c @@ -931,7 +931,10 @@ main(int argc, char *argv[]) } } - cfg_read(); + retval = cfg_read(); + if (retval) { + ovs_fatal(retval, "could not read config file"); + } for (;;) { unixctl_server_run(unixctl); @@ -1064,6 +1067,7 @@ parse_options(int argc, char *argv[]) "use --help for usage"); } + cfg_init(); config_file = argv[0]; error = cfg_set_file(config_file); if (error) { diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index 8c87feab..01645adf 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -80,7 +80,10 @@ main(int argc, char *argv[]) } unixctl_command_register("vswitchd/reload", reload); - cfg_read(); + retval = cfg_read(); + if (retval) { + ovs_fatal(retval, "could not read config file"); + } mgmt_init(); bridge_init(); port_init(); @@ -219,6 +222,7 @@ parse_options(int argc, char *argv[]) "use --help for usage"); } + cfg_init(); config_file = argv[0]; error = cfg_set_file(config_file); if (error) { -- 2.30.2