Hi Zoltan,
I am reading the source of nanomsg and found some a little inconsistency. in nn_sendmsg() from the man page. 1. Return value. "Otherwise, negative number is returned and errno is set..." The negative number is -1 in every case. It would be nice to says that explicitly.
That's also true for other functions. It's always -1 rather than random negative number.
2. Behaviour regarding the pre-allocated message buffer: "Alternatively, to send a buffer allocated by nn_allocmsg(3) function set iov_base to point to the pointer to the buffer and iov_len to NN_MSG constant. The buffer will be deallocated by nn_send function. Trying to deallocate it afterwards will result in undefined behaviour. Also, scatter array in nn_msghdr structure can contain only one element in this case." The message buffer is *not* deallocated in case an error is returned early. The values of errno where it's not deallocated are: EINVAL, EMSGSIZE, EFAULT.
Yes, true.
These error values are not even documented in the man page.
Would you like to patch it? The documentation source is in /doc subdirectory in asciidoc (text-based) format.
Martin