[nanomsg] nn_sendmsg man page vs. source code

  • From: Boszormenyi Zoltan <zboszor@xxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Tue, 24 Sep 2013 10:36:03 +0200

Hi,

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.

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.
These error values are not even documented in the man page.

Best regards,
Zoltán Böszörményi


Other related posts: