mirror of
https://github.com/golang/go
synced 2024-11-23 02:10:03 -07:00
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
This commit is contained in:
parent
b46d56ae72
commit
9d2b0e86c8
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user