about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
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;