summaryrefslogtreecommitdiffhomepage
path: root/libbb/xfuncs.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-13 21:26:20 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-13 21:26:20 +0000
commit1d6a4aec2cbe09ba21a6b5f8dc5dec7d341f7ba1 (patch)
tree323221fc8ddb27e44d39c8b329bd20a5166675f9 /libbb/xfuncs.c
parentfbf6dea5a288362564c4ab4859a1018e1f2dcde4 (diff)
make xsocket die with address family printed (if VERBOSE_RESOLUTION_ERRORS=y)
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r--libbb/xfuncs.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 7fe5c3a45..7e1109470 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -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;
}