mirror of
https://github.com/golang/go
synced 2024-11-22 04:44:39 -07:00
runtime: better panic for send to nil channel
*Much* better on NaCl, where memory faults are deadly. R=r CC=golang-dev https://golang.org/cl/2249041
This commit is contained in:
parent
e769342614
commit
d4baf3ccb7
@ -403,6 +403,9 @@ void
|
|||||||
int32 o;
|
int32 o;
|
||||||
byte *ae;
|
byte *ae;
|
||||||
|
|
||||||
|
if(c == nil)
|
||||||
|
panicstring("send to nil channel");
|
||||||
|
|
||||||
o = rnd(sizeof(c), c->elemalign);
|
o = rnd(sizeof(c), c->elemalign);
|
||||||
ae = (byte*)&c + o;
|
ae = (byte*)&c + o;
|
||||||
chansend(c, ae, nil);
|
chansend(c, ae, nil);
|
||||||
@ -416,6 +419,9 @@ void
|
|||||||
int32 o;
|
int32 o;
|
||||||
byte *ae, *ap;
|
byte *ae, *ap;
|
||||||
|
|
||||||
|
if(c == nil)
|
||||||
|
panicstring("send to nil channel");
|
||||||
|
|
||||||
o = rnd(sizeof(c), c->elemalign);
|
o = rnd(sizeof(c), c->elemalign);
|
||||||
ae = (byte*)&c + o;
|
ae = (byte*)&c + o;
|
||||||
o = rnd(o+c->elemsize, Structrnd);
|
o = rnd(o+c->elemsize, Structrnd);
|
||||||
|
Loading…
Reference in New Issue
Block a user