make xsocket die with address family printed (if VERBOSE_RESOLUTION_ERRORS=y)

This commit is contained in:
Denis Vlasenko 2007-04-13 21:26:20 +00:00
parent fbf6dea5a2
commit 1d6a4aec2c

View File

@ -540,7 +540,18 @@ int xsocket(int domain, int type, int protocol)
{
int r = socket(domain, type, protocol);
if (r < 0) bb_perror_msg_and_die("socket");
if (r < 0) {
/* Hijack vaguely related config option */
#if ENABLE_VERBOSE_RESOLUTION_ERRORS
const char *s = "INET";
if (domain == AF_PACKET) s = "PACKET";
if (domain == AF_NETLINK) s = "NETLINK";
USE_FEATURE_IPV6(if (domain == AF_INET6) s = "INET6";)
bb_perror_msg_and_die("socket(AF_%s)", s);
#else
bb_perror_msg_and_die("socket");
#endif
}
return r;
}