diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/9pfuse/fuse.c | 15 | ||||
-rw-r--r-- | src/cmd/9pfuse/main.c | 4 | ||||
-rw-r--r-- | src/cmd/9pserve.c | 2 | ||||
-rw-r--r-- | src/cmd/9term/rcstart.c | 1 | ||||
-rw-r--r-- | src/cmd/acme/acme.c | 7 | ||||
-rw-r--r-- | src/cmd/acme/exec.c | 1 | ||||
-rw-r--r-- | src/cmd/acme/rows.c | 2 | ||||
-rw-r--r-- | src/cmd/devdraw/x11-init.c | 2 | ||||
-rw-r--r-- | src/cmd/devdraw/x11-itrans.c | 4 | ||||
-rw-r--r-- | src/cmd/draw/mc.c | 14 | ||||
-rw-r--r-- | src/cmd/fontsrv/osx.c | 10 | ||||
-rw-r--r-- | src/cmd/fontsrv/x11.c | 1 | ||||
-rw-r--r-- | src/cmd/sam/error.c | 2 | ||||
-rw-r--r-- | src/cmd/samterm/plan9.c | 9 |
14 files changed, 57 insertions, 17 deletions
diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c index 3f91ce78..66f66065 100644 --- a/src/cmd/9pfuse/fuse.c +++ b/src/cmd/9pfuse/fuse.c @@ -48,7 +48,6 @@ readfusemsg(void) int n, nn; m = allocfusemsg(); - errno = 0; /* * The FUSE kernel device apparently guarantees * that this read will return exactly one message. @@ -57,7 +56,11 @@ readfusemsg(void) * FUSE returns an ENODEV error, not EOF, * when the connection is unmounted. */ - if((n = read(fusefd, m->buf, fusebufsize)) < 0){ + do{ + errno = 0; + n = read(fusefd, m->buf, fusebufsize); + }while(n < 0 && errno == EINTR); + if(n < 0){ if(errno != ENODEV) sysfatal("readfusemsg: %r"); } @@ -807,6 +810,8 @@ mountfuse(char *mtpt) "/Support/load_osxfusefs"), 0) < 0 && access((v="osxfuse", f="/Library/Filesystems/osxfuse.fs" "/Contents/Resources/load_osxfuse"), 0) < 0 && + access((v="osxfuse", f="/opt/local/Library/Filesystems/osxfuse.fs" + "/Contents/Resources/load_osxfuse"), 0) < 0 && access((v="fusefs", f="/System/Library/Extensions/fusefs.kext" "/Contents/Resources/load_fusefs"), 0) < 0 && access(f="/Library/Extensions/fusefs.kext" @@ -871,6 +876,12 @@ mountfuse(char *mtpt) execl("/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse", "mount_osxfuse", buf, mtpt, nil); + /* OSXFUSE >=3.3 from macports */ + putenv("MOUNT_OSXFUSE_DAEMON_PATH", + "/opt/local/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse"); + execl("/opt/local/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse", + "mount_osxfuse", buf, mtpt, nil); + /* Lion OSXFUSE location */ putenv("MOUNT_FUSEFS_DAEMON_PATH", "/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs"); diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c index cbce3ffd..a3662898 100644 --- a/src/cmd/9pfuse/main.c +++ b/src/cmd/9pfuse/main.c @@ -505,7 +505,9 @@ fusesetattr(FuseMsg *m) if(in->valid&FATTR_MTIME) d.mtime = in->mtime; if(in->valid&FATTR_MODE) - d.mode = in->mode; + d.mode = in->mode & 0777; + if((in->mode&S_IFMT) == S_IFDIR) + d.mode |= DMDIR; if((in->valid&FATTR_UID) || (in->valid&FATTR_GID)){ /* * I can't be bothered with these yet. diff --git a/src/cmd/9pserve.c b/src/cmd/9pserve.c index 077715d6..24c80714 100644 --- a/src/cmd/9pserve.c +++ b/src/cmd/9pserve.c @@ -1248,6 +1248,8 @@ mread9p(Ioproc *io, int fd) nn = convM2S(pkt, n, &m->tx); if(nn != n){ fprint(2, "%T read bad packet from %d\n", fd); + free(m->tpkt); + free(m); return nil; } return m; diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c index 5e6e1119..141b9b00 100644 --- a/src/cmd/9term/rcstart.c +++ b/src/cmd/9term/rcstart.c @@ -87,6 +87,7 @@ rcstart(int argc, char **argv, int *pfd, int *tfd) // Set $termprog to 9term or win for those who care about what kind of // dumb terminal this is. putenv("termprog", (char*)termprog); + putenv("TERM_PROGRAM", (char*)termprog); pid = fork(); switch(pid){ diff --git a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c index 10dcdcc8..742aabdf 100644 --- a/src/cmd/acme/acme.c +++ b/src/cmd/acme/acme.c @@ -383,7 +383,7 @@ int erroutfd; void acmeerrorproc(void *v) { - char *buf; + char *buf, *s; int n; USED(v); @@ -391,8 +391,11 @@ acmeerrorproc(void *v) buf = emalloc(8192+1); while((n=read(errorfd, buf, 8192)) >= 0){ buf[n] = '\0'; - sendp(cerr, estrdup(buf)); + s = estrdup(buf); + sendp(cerr, s); + free(s); } + free(buf); } void diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c index fbc249d8..7ad28872 100644 --- a/src/cmd/acme/exec.c +++ b/src/cmd/acme/exec.c @@ -197,6 +197,7 @@ execute(Text *t, uint aq0, uint aq1, int external, Text *argt) aa = getbytearg(argt, TRUE, TRUE, &a); if(a){ if(strlen(a) > EVENTSIZE){ /* too big; too bad */ + free(r); free(aa); free(a); warning(nil, "argument string too long\n"); diff --git a/src/cmd/acme/rows.c b/src/cmd/acme/rows.c index 2d6cbcca..8cff0855 100644 --- a/src/cmd/acme/rows.c +++ b/src/cmd/acme/rows.c @@ -613,6 +613,7 @@ rowload(Row *row, char *file, int initing) } textdelete(&row->col[i]->tag, 0, row->col[i]->tag.file->b.nc, TRUE); textinsert(&row->col[i]->tag, 0, r+n+1, nr-(n+1), TRUE); + free(r); break; case 'w': l[Blinelen(b)-1] = 0; @@ -626,6 +627,7 @@ rowload(Row *row, char *file, int initing) } textdelete(&row->tag, 0, row->tag.file->b.nc, TRUE); textinsert(&row->tag, 0, r, nr, TRUE); + free(r); break; default: done = 1; diff --git a/src/cmd/devdraw/x11-init.c b/src/cmd/devdraw/x11-init.c index 04b13a03..5363fb74 100644 --- a/src/cmd/devdraw/x11-init.c +++ b/src/cmd/devdraw/x11-init.c @@ -176,6 +176,7 @@ _xattach(char *label, char *winsize) } } } + XFree(pfmt); if(_x.chan == 0){ werrstr("could not determine screen pixel format"); goto err0; @@ -232,6 +233,7 @@ _xattach(char *label, char *winsize) geom = smprint("%s.geometry", label); if(geom && XrmGetResource(database, geom, nil, &geomrestype, &geomres)) mask = XParseGeometry(geomres.addr, &x, &y, (uint*)&width, (uint*)&height); + XrmDestroyDatabase(database); free(geom); if((mask & WidthValue) && (mask & HeightValue)){ diff --git a/src/cmd/devdraw/x11-itrans.c b/src/cmd/devdraw/x11-itrans.c index d84cdc8f..729f2647 100644 --- a/src/cmd/devdraw/x11-itrans.c +++ b/src/cmd/devdraw/x11-itrans.c @@ -431,8 +431,10 @@ _xgetsnarffrom(XWindow w, Atom clipboard, Atom target, int timeout0, int timeout usleep(10*1000); XGetWindowProperty(_x.display, _x.drawable, prop, 0, 0, 0, AnyPropertyType, &type, &fmt, &dummy, &len, &xdata); - if(lastlen == len && len > 0) + if(lastlen == len && len > 0){ + XFree(xdata); break; + } lastlen = len; XFree(xdata); } diff --git a/src/cmd/draw/mc.c b/src/cmd/draw/mc.c index c24d67b3..ea36e28d 100644 --- a/src/cmd/draw/mc.c +++ b/src/cmd/draw/mc.c @@ -268,8 +268,8 @@ void getwidth(void) { CFsys *fs; - char buf[500], *p, *q, *f[10]; - int fd, n, nf; + char buf[500], *p, *q, *f[10], *fname; + int fd, n, nf, scale; struct winsize ws; Font *f1; @@ -285,15 +285,19 @@ getwidth(void) buf[n] = 0; if((nf=tokenize(buf, f, nelem(f))) < 7) return; + // hidpi font in stringwidth(3) will call scalesubfont, + // which aborts in bytesperline, due to unknow depth, + // without initdraw. We scale by ourselves. + scale = parsefontscale(f[6], &fname); tabwid = 0; - if(nf >= 8 && (tabwid = atoi(f[7])) == 0) + if(nf >= 8 && (tabwid = atoi(f[7])/scale) == 0) return; - if((font = openfont(nil, f[6])) == nil) + if((font = openfont(nil, fname)) == nil) return; mintab = stringwidth(font, "0"); if(tabwid == 0) tabwid = mintab*4; - linewidth = atoi(f[5]); + linewidth = atoi(f[5]) / scale; tabflag = 1; return; } diff --git a/src/cmd/fontsrv/osx.c b/src/cmd/fontsrv/osx.c index f48f5b49..4d969290 100644 --- a/src/cmd/fontsrv/osx.c +++ b/src/cmd/fontsrv/osx.c @@ -30,7 +30,7 @@ mapUnicode(char *name, int i) { int j; - if(0xd800 <= i && i < 0xe0000) // surrogate pairs, will crash OS X libraries! + if(0xd800 <= i && i < 0xe000) // surrogate pairs, will crash OS X libraries! return 0xfffd; for(j=0; j<nelem(skipquotemap); j++) { if(strstr(name, skipquotemap[j])) @@ -104,6 +104,7 @@ static char *lines[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz", "g", + "┌┬┐├┼┤└┴┘│─", "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει.", "私はガラスを食べられます。それは私を傷つけません。", "Aš galiu valgyti stiklą ir jis manęs nežeidžia", @@ -234,7 +235,7 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias) bbox = CTFontGetBoundingBox(font); - x = (int)(bbox.size.width + 0.99999999); + x = (int)(bbox.size.width*2 + 0.99999999); fontheight(f, size, &height, &ascent); y = height; @@ -244,8 +245,10 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias) if(m == nil) return nil; mc = allocmemimage(Rect(0, 0, x+1, y+1), GREY8); - if(mc == nil) + if(mc == nil){ + freememimage(m); return nil; + } memfillcolor(m, DBlack); memfillcolor(mc, DBlack); fc = malloc((hi+2 - lo) * sizeof fc[0]); @@ -343,6 +346,7 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias) m1 = allocmemimage(Rect(0, 0, x, y), antialias ? GREY8 : GREY1); memimagedraw(m1, m1->r, m, m->r.min, memopaque, ZP, S); freememimage(m); + freememimage(mc); sf->name = nil; sf->n = hi+1 - lo; diff --git a/src/cmd/fontsrv/x11.c b/src/cmd/fontsrv/x11.c index f106d253..a097ca4d 100644 --- a/src/cmd/fontsrv/x11.c +++ b/src/cmd/fontsrv/x11.c @@ -236,6 +236,7 @@ mksubfont(XFont *xf, char *name, int lo, int hi, int size, int antialias) m1 = allocmemimage(Rect(0, 0, x, y), antialias ? GREY8 : GREY1); memimagedraw(m1, m1->r, m, m->r.min, memopaque, ZP, S); freememimage(m); + freememimage(mc); sf->name = nil; sf->n = hi+1 - lo; diff --git a/src/cmd/sam/error.c b/src/cmd/sam/error.c index eb4e48f4..70554e19 100644 --- a/src/cmd/sam/error.c +++ b/src/cmd/sam/error.c @@ -138,7 +138,7 @@ termwrite(char *s) else Strinsert(&cmdstr, p, cmdstr.n); cmdptadv += p->n; - free(p); + freetmpstr(p); }else Write(2, s, strlen(s)); } diff --git a/src/cmd/samterm/plan9.c b/src/cmd/samterm/plan9.c index 469d566e..1b933578 100644 --- a/src/cmd/samterm/plan9.c +++ b/src/cmd/samterm/plan9.c @@ -53,8 +53,10 @@ getscreen(int argc, char **argv) threadexitsall("init"); } t = getenv("tabstop"); - if(t != nil) + if(t != nil){ maxtab = strtoul(t, nil, 0); + free(t); + } draw(screen, screen->clipr, display->white, nil, ZP); } @@ -149,10 +151,13 @@ extstart(void) if(user == nil) return; disp = getenv("DISPLAY"); - if(disp) + if(disp){ exname = smprint("/tmp/.sam.%s.%s", user, disp); + free(disp); + } else exname = smprint("/tmp/.sam.%s", user); + free(user); if(exname == nil){ fprint(2, "not posting for B: out of memory\n"); return; |