vswitchd: Avoid writing to const struct
authorEd Maste <emaste@freebsd.org>
Sat, 8 Dec 2012 23:23:12 +0000 (18:23 -0500)
committerBen Pfaff <blp@nicira.com>
Sat, 8 Dec 2012 23:26:14 +0000 (15:26 -0800)
When built with Clang, vswitchd segfaulted in ovsrec_open_vswitch_init,
from calling memset() on a const struct.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
vswitchd/bridge.c

index 53dd2f6..f508d58 100644 (file)
@@ -2114,7 +2114,7 @@ bridge_run_fast(void)
 void
 bridge_run(void)
 {
-    static const struct ovsrec_open_vswitch null_cfg;
+    static struct ovsrec_open_vswitch null_cfg;
     const struct ovsrec_open_vswitch *cfg;
     struct ovsdb_idl_txn *reconf_txn = NULL;
     struct sset types;
@@ -2123,7 +2123,7 @@ bridge_run(void)
     bool vlan_splinters_changed;
     struct bridge *br;
 
-    ovsrec_open_vswitch_init((struct ovsrec_open_vswitch *) &null_cfg);
+    ovsrec_open_vswitch_init(&null_cfg);
 
     /* (Re)configure if necessary. */
     if (!reconfiguring) {