summaryrefslogtreecommitdiff
path: root/src/libstddjb/fd_shutdown.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-11-20 15:22:48 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-11-20 15:22:48 +0000
commitcc31550d01415181e70150ad3e9043d049b07a09 (patch)
tree8631f84ba6390798f72576552f2c1b869e64ff3b /src/libstddjb/fd_shutdown.c
parent155f489a29ecc7d7b9b66e435739e69f40653562 (diff)
downloadskalibs-cc31550d01415181e70150ad3e9043d049b07a09.tar.xz
Add fd_shutdown()
Diffstat (limited to 'src/libstddjb/fd_shutdown.c')
-rw-r--r--src/libstddjb/fd_shutdown.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstddjb/fd_shutdown.c b/src/libstddjb/fd_shutdown.c
new file mode 100644
index 0000000..52e00c7
--- /dev/null
+++ b/src/libstddjb/fd_shutdown.c
@@ -0,0 +1,14 @@
+/* ISC license. */
+
+#include <skalibs/nonposix.h>
+#include <errno.h>
+#include <sys/socket.h>
+
+#include <skalibs/djbunix.h>
+
+void fd_shutdown (int fd, int h)
+{
+ int e = errno ;
+ shutdown(fd, h ? SHUT_WR : SHUT_RD) ;
+ errno = e ;
+}