Fix incosistent error code handling in tcp_bind. #689

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@txdv
Contributor
txdv commented Jan 18, 2013

Just like tcp_connect and udp_bind it should return an EINVAL when the
handle is of an invalid type or when the network address is faulty.

The error codes are inconsistent when checking for bad addresses:

https://github.com/joyent/libuv/blob/master/test/test-tcp-connect-error.c#L60
https://github.com/joyent/libuv/blob/master/test/test-tcp-bind-error.c#L131

The first returns EINVAL, the other EFAULT. I discussed with bnoordhuis this on the channel, it shoulds return EINVAL, because EFAULT means bad memory.

Furthermore, uv_tcp/udp_bind and uv_tcp_connect does checks on the handle and address but uv_udp_send doesn't. Should it check for a valid handle and a valid address too?

@txdv txdv Fix incosistent error code handling in tcp_bind.
Just like tcp_connect and udp_bind it should return an EINVAL when the
handle is of an invalid type or when the network address is faulty.
073b8be
@bnoordhuis
Contributor

Thanks, landed in 017e2d5.

@bnoordhuis bnoordhuis closed this Jan 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment