diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/acme/util.c | 4 | ||||
-rw-r--r-- | src/cmd/plumb/plumber.c | 7 | ||||
-rw-r--r-- | src/cmd/plumb/rules.c | 1 | ||||
-rw-r--r-- | src/libdraw/font.c | 2 | ||||
-rw-r--r-- | src/libdraw/stringwidth.c | 2 | ||||
-rw-r--r-- | src/libframe/frbox.c | 5 | ||||
-rw-r--r-- | src/libfs/read.c | 3 | ||||
-rw-r--r-- | src/libfs/write.c | 3 | ||||
-rw-r--r-- | src/libthread/main.c | 2 |
9 files changed, 20 insertions, 9 deletions
diff --git a/src/cmd/acme/util.c b/src/cmd/acme/util.c index 180b2bd2..cfbfae3f 100644 --- a/src/cmd/acme/util.c +++ b/src/cmd/acme/util.c @@ -298,7 +298,7 @@ tgetc(void *a, uint n) Rune* skipbl(Rune *r, int n, int *np) { - while(n>0 && *r==' ' || *r=='\t' || *r=='\n'){ + while(n>0 && (*r==' ' || *r=='\t' || *r=='\n')){ --n; r++; } @@ -309,7 +309,7 @@ skipbl(Rune *r, int n, int *np) Rune* findbl(Rune *r, int n, int *np) { - while(n>0 && *r!=' ' && *r!='\t' && *r!='\n'){ + while(n>0 && (*r!=' ' && *r!='\t' && *r!='\n')){ --n; r++; } diff --git a/src/cmd/plumb/plumber.c b/src/cmd/plumb/plumber.c index ae45f933..54c60521 100644 --- a/src/cmd/plumb/plumber.c +++ b/src/cmd/plumb/plumber.c @@ -29,14 +29,18 @@ void threadmain(int argc, char *argv[]) { char buf[512]; - int fd; + int fd, dofork; progname = "plumber"; + dofork = 1; ARGBEGIN{ case 'd': debug = 1; break; + case 'f': + dofork = 0; + break; case 'p': plumbfile = ARGF(); break; @@ -66,6 +70,7 @@ threadmain(int argc, char *argv[]) * Start all processes and threads from other proc * so we (main pid) can return to user. */ + if(dofork) switch(fork()){ case -1: sysfatal("fork: %r"); diff --git a/src/cmd/plumb/rules.c b/src/cmd/plumb/rules.c index 52a3d8e5..689edf59 100644 --- a/src/cmd/plumb/rules.c +++ b/src/cmd/plumb/rules.c @@ -741,6 +741,7 @@ morerules(uchar *text, int done) ; while((rs=readruleset()) != nil){ rules = erealloc(rules, (n+2)*sizeof(Ruleset*)); + fprint(2, "initialize rules %d %d\n", n, n+1); rules[n++] = rs; rules[n] = nil; } diff --git a/src/libdraw/font.c b/src/libdraw/font.c index 6b14d3fc..9feffa42 100644 --- a/src/libdraw/font.c +++ b/src/libdraw/font.c @@ -28,7 +28,7 @@ cachechars(Font *f, char **ss, Rune **rr, ushort *cp, int max, int *wp, char **s } wid = 0; *subfontname = 0; - for(i=0; (*sp || *rp) && i<max; sp+=w, rp+=rw){ + for(i=0; i<max && (*sp || *rp); sp+=w, rp+=rw){ if(ss){ r = *(uchar*)sp; if(r < Runeself) diff --git a/src/libdraw/stringwidth.c b/src/libdraw/stringwidth.c index c4877912..f0d13721 100644 --- a/src/libdraw/stringwidth.c +++ b/src/libdraw/stringwidth.c @@ -25,7 +25,7 @@ _stringnwidth(Font *f, char *s, Rune *r, int len) }else rptr = &r; twid = 0; - while((*s || *r) && len){ + while(len && (*s || *r)){ max = Max; if(len < max) max = len; diff --git a/src/libframe/frbox.c b/src/libframe/frbox.c index d2593011..beb37c16 100644 --- a/src/libframe/frbox.c +++ b/src/libframe/frbox.c @@ -115,9 +115,12 @@ static void chopbox(Frame *f, Frbox *b, int n) /* drop first n chars; no allocation done */ { + char *p; + if(b->nrune<0 || b->nrune<n) drawerror(f->display, "chopbox"); - strcpy((char*)b->ptr, (char*)runeindex(b->ptr, n)); + p = (char*)runeindex(b->ptr, n); + memmove((char*)b->ptr, p, strlen(p)+1); b->nrune -= n; b->wid = stringwidth(f->font, (char *)b->ptr); } diff --git a/src/libfs/read.c b/src/libfs/read.c index 7cd4fd14..9765602c 100644 --- a/src/libfs/read.c +++ b/src/libfs/read.c @@ -28,7 +28,8 @@ fprint(2, "n %d msize %d\n", n, msize); tx.offset = offset; tx.count = n; - fsrpc(fid->fs, &tx, &rx, &freep); + if(fsrpc(fid->fs, &tx, &rx, &freep) < 0) + return -1; if(rx.type == Rerror){ werrstr("%s", rx.ename); free(freep); diff --git a/src/libfs/write.c b/src/libfs/write.c index bae2083e..5da27d12 100644 --- a/src/libfs/write.c +++ b/src/libfs/write.c @@ -24,7 +24,8 @@ _fspwrite(Fid *fid, void *buf, long n, vlong offset) tx.count = n; tx.data = buf; - fsrpc(fid->fs, &tx, &rx, &freep); + if(fsrpc(fid->fs, &tx, &rx, &freep) < 0) + return -1; if(rx.type == Rerror){ werrstr("%s", rx.ename); free(freep); diff --git a/src/libthread/main.c b/src/libthread/main.c index 96d99335..cbecad53 100644 --- a/src/libthread/main.c +++ b/src/libthread/main.c @@ -45,7 +45,7 @@ main(int argc, char **argv) signal(SIGTERM, _threaddie); signal(SIGCHLD, _nop); - signal(SIGINFO, _threadstatus); +// signal(SIGINFO, _threadstatus); // rfork(RFREND); //_threaddebuglevel = (DBGSCHED|DBGCHAN|DBGREND)^~0; |