diff --git a/sys/src/9/port/devproc.c b/sys/src/9/port/devproc.c index 29b8031c1..699283f5b 100644 --- a/sys/src/9/port/devproc.c +++ b/sys/src/9/port/devproc.c @@ -1164,7 +1164,11 @@ procwrite(Chan *c, void *va, long n, vlong off) * than the process pgrpid */ if(QID(c->qid) == Qnotepg) { - pgrpnote(NOTEID(c->pgrpid), va, n, NUser); + if(n >= ERRMAX-1) + error(Etoobig); + memmove(buf, va, n); + buf[n] = 0; + pgrpnote(NOTEID(c->pgrpid), buf, NUser); return n; } diff --git a/sys/src/9/port/pgrp.c b/sys/src/9/port/pgrp.c index 5de7c695f..190ab7b59 100644 --- a/sys/src/9/port/pgrp.c +++ b/sys/src/9/port/pgrp.c @@ -13,16 +13,10 @@ static Ref pgrpid; static Ref mountid; void -pgrpnote(ulong noteid, char *a, long n, int flag) +pgrpnote(ulong noteid, char *n, int flag) { Proc *p, *ep; - char buf[ERRMAX]; - if(n >= ERRMAX-1) - error(Etoobig); - - memmove(buf, a, n); - buf[n] = 0; p = proctab(0); for(ep = p+conf.nproc; p < ep; p++) { if(p->state == Dead) @@ -30,7 +24,7 @@ pgrpnote(ulong noteid, char *a, long n, int flag) if(up != p && p->noteid == noteid && p->kp == 0) { qlock(&p->debug); if(p->noteid == noteid) - postnote(p, 0, buf, flag); + postnote(p, 0, n, flag); qunlock(&p->debug); } } diff --git a/sys/src/9/port/portfns.h b/sys/src/9/port/portfns.h index 993dd4758..a37777c20 100644 --- a/sys/src/9/port/portfns.h +++ b/sys/src/9/port/portfns.h @@ -214,7 +214,7 @@ void pathclose(Path*); ulong perfticks(void); void pexit(char*, int); void pgrpcpy(Pgrp*, Pgrp*); -void pgrpnote(ulong, char*, long, int); +void pgrpnote(ulong, char*, int); int pidalloc(Proc*); #define poperror() up->nerrlab-- void portcountpagerefs(ulong*, int);