Commit 9d2b0e86 authored by Russ Cox's avatar Russ Cox

cmd/ld: skip 0-length write in cwrite

The 0-length part is fine, but some callers that write 0 bytes
also pass nil as the data pointer, and the Plan 9 kernel kills the
process with 'invalid address in sys call' in that case.

R=ken2
CC=golang-dev
https://golang.org/cl/6862051
parent b46d56ae
......@@ -1493,6 +1493,8 @@ void
cwrite(void *buf, int n)
{
cflush();
if(n <= 0)
return;
if(write(cout, buf, n) != n) {
diag("write error: %r");
errorexit();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment