mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
devdraw/OSX: correct access to reply buffer (fixes rpc tag crash)
This commit is contained in:
parent
6c99870701
commit
607880ce78
1 changed files with 4 additions and 0 deletions
|
@ -289,6 +289,7 @@ runmsg(Wsysmsg *m)
|
||||||
/*
|
/*
|
||||||
* Reply to m.
|
* Reply to m.
|
||||||
*/
|
*/
|
||||||
|
QLock replylock;
|
||||||
void
|
void
|
||||||
replymsg(Wsysmsg *m)
|
replymsg(Wsysmsg *m)
|
||||||
{
|
{
|
||||||
|
@ -303,6 +304,8 @@ replymsg(Wsysmsg *m)
|
||||||
if(trace) fprint(2, "-> %W\n", m);
|
if(trace) fprint(2, "-> %W\n", m);
|
||||||
/* copy to output buffer */
|
/* copy to output buffer */
|
||||||
n = sizeW2M(m);
|
n = sizeW2M(m);
|
||||||
|
|
||||||
|
qlock(&replylock);
|
||||||
if(n > nmbuf){
|
if(n > nmbuf){
|
||||||
free(mbuf);
|
free(mbuf);
|
||||||
mbuf = malloc(n);
|
mbuf = malloc(n);
|
||||||
|
@ -313,6 +316,7 @@ replymsg(Wsysmsg *m)
|
||||||
convW2M(m, mbuf, n);
|
convW2M(m, mbuf, n);
|
||||||
if(write(4, mbuf, n) != n)
|
if(write(4, mbuf, n) != n)
|
||||||
sysfatal("write: %r");
|
sysfatal("write: %r");
|
||||||
|
qunlock(&replylock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue