summaryrefslogtreecommitdiff
path: root/libbb/bb_xbind.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-04-12 18:24:37 +0000
committerBernhard Reutner-Fischer2006-04-12 18:24:37 +0000
commit67f641e75b685abe1588b634b409c1ee2ff68c22 (patch)
tree74b3e38f1b7caef23bbf06a92b6e5d05530d50a6 /libbb/bb_xbind.c
parent2c99851181a652358aa3ca58ef38c57e46ae02e4 (diff)
downloadbusybox-67f641e75b685abe1588b634b409c1ee2ff68c22.zip
busybox-67f641e75b685abe1588b634b409c1ee2ff68c22.tar.gz
- patch from Denis Vlasenko to add bb_xbind() and bb_xlisten()
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 0000000..8a45af3
--- /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");
+}
+