On Wed, Dec 30, 2009 at 19:27 +0000, konrad merz wrote: > now really. you've uncovered a big problem in the current implementation. icb_parse, fields[], etc is evil. i need to reimplement this properly.
as to dns part, i think your diff is not correct. you should test read return value against -1 as an indication of the closed socket. > Index: usr.sbin/icbd/cmd.c > =================================================================== > RCS file: /cvs/src/usr.sbin/icbd/cmd.c,v > retrieving revision 1.19 > diff -u -p -r1.19 cmd.c > --- usr.sbin/icbd/cmd.c 23 Jun 2009 13:39:33 -0000 1.19 > +++ usr.sbin/icbd/cmd.c 30 Dec 2009 19:06:18 -0000 > @@ -227,9 +227,15 @@ icb_cmd_topic(struct icb_cmdarg *ca) > char buf[ICB_MAXGRPLEN + ICB_MAXTOPICLEN + 25]; > struct icb_group *ig = ca->sess->group; > > - if (strlen(ca->arg) == 0) { > - (void)snprintf(buf, sizeof buf, "Topic for %s is \"%s\"", > - ig->name, ig->topic); > + if (ca->arg == NULL) { > + if (strlen(ig->topic) > 0) > + (void)snprintf(buf, sizeof buf, > + "Topic for %s is \"%s\"", > + ig->name, ig->topic); > + else > + (void)snprintf(buf, sizeof buf, "No topic set for %s", > + ig->name); > + > icb_status(ca->sess, STATUS_TOPIC, buf); > return; > } > Index: usr.sbin/icbd/dns.c > =================================================================== > RCS file: /cvs/src/usr.sbin/icbd/dns.c,v > retrieving revision 1.1 > diff -u -p -r1.1 dns.c > --- usr.sbin/icbd/dns.c 23 Jun 2009 13:39:33 -0000 1.1 > +++ usr.sbin/icbd/dns.c 30 Dec 2009 19:06:18 -0000 > @@ -114,7 +114,7 @@ dns_dispatch(int fd, short event, void * > > if (read(fd, &ss, ss_len) != ss_len) { > syslog(LOG_ERR, "dns read: %m"); > - return; > + exit(1); > } > > if ((gerr = getnameinfo(sa, sa->sa_len,