On Tue, Feb 21, 2017 at 11:18:04PM +0200, Sagi Grimberg wrote: > I can maybe do something like: > > if (af == AF_INET || af == AF_UNSPEC) { > ret = inet4_pton(); > if (!ret) > return 0; > else if (af != AF_UNSPEC) > return ret; > } > > if (af == AF_INET6 || af == AF_UNSPEC) { > ret = inet6_pton(); > if (!ret) > return 0; > else if (af != AF_UNSPEC) > return ret; > } > > return -EINVAL; > > better? My idead was the following: switch (af) { case AF_INET: ret = inet_pton(); break; case AF_INET6: ret = inet6_pton(); break; case AF_UNSPEC: ret = inet6_pton(); if (ret) ret = inet_pton(); break; } -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html