aboutsummaryrefslogtreecommitdiff
path: root/libbb/bb_xbind.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/bb_xbind.c')
-rw-r--r--libbb/bb_xbind.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libbb/bb_xbind.c b/libbb/bb_xbind.c
new file mode 100644
index 000000000..8a45af3bb
--- /dev/null
+++ b/libbb/bb_xbind.c
@@ -0,0 +1,18 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * bb_xbind.c - a bind() which dies on failure with error message
+ *
+ * Copyright (C) 2006 Denis Vlasenko
+ *
+ * Licensed under LGPL, see file docs/lesser.txt in this tarball for details.
+ */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include "libbb.h"
+
+void bb_xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen)
+{
+ if (bind(sockfd, my_addr, addrlen))
+ bb_perror_msg_and_die("bind");
+}
+