vswitchd: Initialize cfg properly and check return values
authorJustin Pettit <jpettit@nicira.com>
Sat, 1 Aug 2009 08:03:23 +0000 (01:03 -0700)
committerJustin Pettit <jpettit@nicira.com>
Mon, 3 Aug 2009 18:24:23 +0000 (11:24 -0700)
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
vswitchd/ovs-brcompatd.c
vswitchd/ovs-vswitchd.c

index df942f5..1b52a7b 100644 (file)
@@ -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\"",
index 2384f5c..9254c58 100644 (file)
@@ -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) {
index 8c87fea..01645ad 100644 (file)
@@ -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) {