about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2016-05-26 00:58:25 -0400
committerFedor Indutny <fedor@indutny.com>2016-05-26 00:58:25 -0400
commit476e00fb734d0e129edbc6ad1409a87051a3a735 (patch)
tree77c37f0b28f964ab3ab2c0d3ab1a9172241b005a /src
parent5b9130d710a97c3dbb7fd94fd4199f9f37413ea3 (diff)
downloaduv_link_t-476e00fb734d0e129edbc6ad1409a87051a3a735.tar.gz
link: further chain validation
Diffstat (limited to 'src')
-rw-r--r--src/uv_link_t.c7
1 files changed, 5 insertions, 2 deletions
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;