--- /sys/man/6/style Thu Dec 2 21:41:31 2010 +++ /sys/man/6/style Fri Aug 16 00:02:06 2013 @@ -4,7 +4,7 @@ .SH DESCRIPTION Plan 9 C code has its own conventions. You would do well to follow them. -Here are a few: +Here are a few (and this is not an exhaustive list): .IP • 3 don't use .L // --- /sys/src/9/port/cache.c Fri Aug 2 23:35:32 2013 +++ /sys/src/9/port/cache.c Thu Aug 15 21:06:35 2013 @@ -114,7 +114,7 @@ /* a better algorithm would be nice */ if(conf.npage*BY2PG > 400*MB) - maxcache = 50*MAXCACHE; + maxcache = 20*MAXCACHE; else if(conf.npage*BY2PG > 200*MB) maxcache = 10*MAXCACHE; --- /sys/src/cmd/ndb/convM2DNS.c Thu Oct 13 22:06:27 2011 +++ /sys/src/cmd/ndb/convM2DNS.c Thu Aug 15 21:05:37 2013 @@ -41,13 +41,19 @@ rrname(rp->type, ptype, sizeof ptype)); p = seprint(p, ep, "%d bytes needed; %d remain", need, remain); if (rp) - seprint(p, ep, ": %R", rp); - sp->err = sp->errbuf; - /* hack to cope with servers that don't set Ftrunc when they should */ - if (remain < Maxudp && need > Maxudp) + p = seprint(p, ep, ": %R", rp); + /* + * hack to cope with servers that don't set Ftrunc when they should: + * if the (udp) packet is full-sized, if must be truncated because + * it is incomplete. otherwise, it's just garbled. + */ + if (sp->ep - sp->base >= Maxudp) { sp->trunc = 1; + seprint(p, ep, " (truncated)"); + } if (debug && rp) dnslog("malformed rr: %R", rp); + sp->err = sp->errbuf; return 0; } @@ -328,6 +334,7 @@ convM2RR(Scan *sp, char *what) { int type, class, len, left; + char *dn; char dname[Domlen+1]; uchar *data; RR *rp; @@ -396,7 +403,12 @@ break; case Tmx: USHORT(rp->pref); - rp->host = dnlookup(NAME(dname), Cin, 1); + dn = NAME(dname); + rp->host = dnlookup(dn, Cin, 1); + if(strchr((char *)rp->host, '\n') != nil) { + dnslog("newline in mx text for %s", dn); + sp->trunc = 1; /* try again via tcp */ + } break; case Ta: V4ADDR(rp->ip); @@ -555,6 +567,8 @@ * if there are formatting errors or the like during parsing of the message, * set *codep to the outgoing response code (e.g., Rformat), which will * abort processing and reply immediately with the outgoing response code. + * + * ideally would note if len == Maxudp && query was via UDP, for errtoolong. */ char* convM2DNS(uchar *buf, int len, DNSmsg *m, int *codep) --- /sys/src/libmach/executable.c Tue Apr 24 23:23:50 2012 +++ /sys/src/libmach/executable.c Thu Aug 15 21:07:41 2013 @@ -844,7 +844,7 @@ else if(ep->ident[CLASS] == ELFCLASS64) return elf64dotout(fd, fp, hp); - werrstr("bad ELF class - not 32 bit"); + werrstr("bad ELF class - not 32- nor 64-bit"); return 0; }