summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-25 16:35:24 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-25 16:35:24 +0000
commit5202d98629b534b72a22293124b527f3281573f6 (patch)
treec10e4945a3688d1e9989fda3872cb8d6ba04f4e3 /libgo
parent19b8522371c22f5f3edbf9b0e6f39c533d6ae3ef (diff)
downloadgcc-5202d98629b534b72a22293124b527f3281573f6.tar.gz
Don't permit close of receive-only channel.
Better panic on attempt to close nil channel. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180437 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/runtime/go-close.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libgo/runtime/go-close.c b/libgo/runtime/go-close.c
index 44533ebe4c7..778eab3d7d8 100644
--- a/libgo/runtime/go-close.c
+++ b/libgo/runtime/go-close.c
@@ -16,6 +16,9 @@ __go_builtin_close (struct __go_channel *channel)
{
int i;
+ if (channel == NULL)
+ __go_panic_msg ("close of nil channel");
+
i = pthread_mutex_lock (&channel->lock);
__go_assert (i == 0);