Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ACE_INET_Addr::set
errantly succeeds when ACE_LACKS_GETSERVBYNAME
Problem ------- Calling `set("1.2.3.4")` on an ACE_INET_Addr eventually tries to part it as a port name. When `ACE_LACKS_GETSERVBYNAME`, this succeeds returning port number 0 with the reset address. When port names are not expected, this breaks a useful idiom of parsing addresses that may or may not contain port numbers: ACE_INET_Addr addr; if (addr.set(x) == 0) { // Success, address contained a port number } else if (addr.set(u_short(0), x) == 0) { // Success, address did not contain a port number. } else { // Fail } Solution -------- Return -1 for the port number when `ACE_LACKS_GETSERVBYNAME`.
- Loading branch information