errno needs to be compared against EINTR/EAGAIN instead of the return code,
and only if the return code is < 0.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Otherwise some flags like USOCK_NONBLOCK wouldn't work as expected
(O_NONBLOCK affects connect behavior).
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Add a new helper function usock_port() which converts the given numeric port number
into a string using a private static buffer. This way a calling application can
conveniently use numeric port arguments without having to convert them before:
int fd = usock(USOCK_UDP, "example.org", usock_port(80));
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>