From: Guus Sliepen Date: Mon, 3 Feb 2020 16:03:07 +0000 (+0100) Subject: Prevent meshlink_errno from being set incorrectly by meshlink_invite() X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=eeb8f3502fdf25704ce2d234732509cad32e8bff;p=meshlink Prevent meshlink_errno from being set incorrectly by meshlink_invite() We called a public API function inside meshlink_invite() to check that we don't try to invite a node that's already known. That causes it to set meshlink_errno to MESHLINK_ENOENT. Fix this by calling lookup_node() instead. --- diff --git a/src/meshlink.c b/src/meshlink.c index 11e45503..0fbcf153 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -2428,7 +2428,7 @@ char *meshlink_invite_ex(meshlink_handle_t *mesh, meshlink_submesh_t *submesh, c } // Ensure no other nodes know about this name - if(meshlink_get_node(mesh, name)) { + if(lookup_node(mesh, name)) { logger(mesh, MESHLINK_ERROR, "A node with name %s is already known!\n", name); meshlink_errno = MESHLINK_EEXIST; pthread_mutex_unlock(&mesh->mutex);