These functions can return NULL both when the parameters are invalid or if
the node or submesh does not exist, meshlink_errno must be set correctly
to distinguish between the two cases.
pthread_mutex_lock(&(mesh->mesh_mutex));
node = (meshlink_node_t *)lookup_node(mesh, (char *)name); // TODO: make lookup_node() use const
pthread_mutex_unlock(&(mesh->mesh_mutex));
+
+ if(!node) {
+ meshlink_errno = MESHLINK_ENOENT;
+ }
+
return node;
}
pthread_mutex_lock(&(mesh->mesh_mutex));
submesh = (meshlink_submesh_t *)lookup_submesh(mesh, name);
pthread_mutex_unlock(&(mesh->mesh_mutex));
+
+ if(!submesh) {
+ meshlink_errno = MESHLINK_ENOENT;
+ }
+
return submesh;
}