socket: Get address option defaults correctly.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 25 Jun 2007 22:18:18 +0000 (23:18 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 25 Jun 2007 22:18:18 +0000 (23:18 +0100)
Ooops: we'd overwrite the address-family-specific defaults with the
generic ones.

socket.c

index c92faad..c85c2d4 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -372,9 +372,10 @@ static source *ssource_read(scanner *sc)
   ss->a = getaddr(sc, ADDR_SRC);
   if (ss->a->ops->initsrcopts)
     ss->ao = ss->a->ops->initsrcopts();
-  else
+  else {
     ss->ao = CREATE(addr_opts);
-  *ss->ao = gsao;
+    *ss->ao = gsao;
+  }
   ss->o = ssgo;
   return (&ss->s);
 }
@@ -633,9 +634,10 @@ static target *starget_read(scanner *sc)
   st->a = getaddr(sc, ADDR_DEST);
   if (st->a->ops->inittargopts)
     st->ao = st->a->ops->inittargopts();
-  else
+  else {
     st->ao = CREATE(addr_opts);
-  *st->ao = gtao;
+    *st->ao = gtao;
+  }
   dstr_puts(&d, "socket.");
   st->a->ops->print(st->a, ADDR_DEST, &d);
   st->t.desc = xstrdup(d.buf);