]> git.meshlink.io Git - meshlink/commitdiff
Prevent meshlink_errno from being set incorrectly by meshlink_invite()
authorGuus Sliepen <guus@meshlink.io>
Mon, 3 Feb 2020 16:03:07 +0000 (17:03 +0100)
committerGuus Sliepen <guus@meshlink.io>
Mon, 3 Feb 2020 16:03:07 +0000 (17:03 +0100)
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.

src/meshlink.c

index 11e45503c4ccbebc9a9098c89a3ae7d52c27008f..0fbcf1535379810fd2295d4d28287a87b1beb774 100644 (file)
@@ -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);