summaryrefslogtreecommitdiff
path: root/src/libstddjb/ipc_bind_reuse.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-11-08 09:32:32 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-11-08 09:32:32 +0000
commitb992db748b9ffe8d88d609950f5da28b5a1db135 (patch)
tree7b3c70238073a643e83caef7a5d1fa1d7ce6bc28 /src/libstddjb/ipc_bind_reuse.c
parent34896cda4e7156a5e232dfa4cde92d1ea1e93da2 (diff)
downloadskalibs-b992db748b9ffe8d88d609950f5da28b5a1db135.tar.xz
Add ipc_bind_reuse_lock, rewrite ipc_bind_reuse to use it
Diffstat (limited to 'src/libstddjb/ipc_bind_reuse.c')
-rw-r--r--src/libstddjb/ipc_bind_reuse.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/libstddjb/ipc_bind_reuse.c b/src/libstddjb/ipc_bind_reuse.c
index 31db745..ce5c7a4 100644
--- a/src/libstddjb/ipc_bind_reuse.c
+++ b/src/libstddjb/ipc_bind_reuse.c
@@ -1,14 +1,9 @@
/* ISC license. */
-#include <skalibs/nonposix.h>
-#include <sys/socket.h>
-#include <unistd.h>
#include <skalibs/webipc.h>
int ipc_bind_reuse (int s, char const *p)
{
- unsigned int opt = 1 ;
- setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt) ;
- unlink(p) ;
- return ipc_bind(s, p) ;
+ int fdlock ;
+ return ipc_bind_reuse_lock(s, p, &fdlock) ;
}