cfgfile_gen: improve printing of SmartGatewayEgressInterfaces
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 30 Apr 2015 09:26:26 +0000 (11:26 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 1 May 2015 07:38:57 +0000 (09:38 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/cfgparser/cfgfile_gen.c

index 8e8637d..dfc9140 100644 (file)
@@ -631,10 +631,13 @@ void olsrd_write_cnf_autobuf(struct autobuf *out, struct olsrd_config *cnf) {
       !cnf->smart_gw_egress_interfaces ? "# " : "");
   {
     struct sgw_egress_if * sgwegressif = olsr_cnf->smart_gw_egress_interfaces;
-    while (sgwegressif) {
-      abuf_appendf(out, " \"%s\"", sgwegressif->name);
-      sgwegressif = sgwegressif->next;
-    }
+    if (!sgwegressif)
+      abuf_puts(out, " \"\"");
+    else
+      while (sgwegressif) {
+        abuf_appendf(out, " \"%s\"", sgwegressif->name);
+        sgwegressif = sgwegressif->next;
+      }
     abuf_puts(out, "\n");
   }
   abuf_appendf(out,