From 476e00fb734d0e129edbc6ad1409a87051a3a735 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Thu, 26 May 2016 00:58:25 -0400 Subject: link: further chain validation --- src/uv_link_t.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/uv_link_t.c b/src/uv_link_t.c index e9f88b5..0e2111e 100644 --- a/src/uv_link_t.c +++ b/src/uv_link_t.c @@ -17,7 +17,10 @@ int uv_link_chain(uv_link_t* from, uv_link_alloc_cb alloc_cb, uv_link_read_cb read_cb) { if (from->child != NULL || to->parent != NULL) - return -1; + return UV_EINVAL; + + if (from->alloc_cb != NULL || from->read_cb != NULL) + return UV_EINVAL; from->child = to; to->parent = from; @@ -31,7 +34,7 @@ int uv_link_chain(uv_link_t* from, int uv_link_unchain(uv_link_t* from, uv_link_t* to) { if (from->child != to || to->parent != from) - return -1; + return UV_EINVAL; from->child = NULL; to->parent = NULL; -- cgit 1.4.1-2-gfad0