summaryrefslogtreecommitdiff
path: root/src/libstddjb/ipc_bind_reuse_lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/ipc_bind_reuse_lock.c')
-rw-r--r--src/libstddjb/ipc_bind_reuse_lock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstddjb/ipc_bind_reuse_lock.c b/src/libstddjb/ipc_bind_reuse_lock.c
index b1bccfd..c872e44 100644
--- a/src/libstddjb/ipc_bind_reuse_lock.c
+++ b/src/libstddjb/ipc_bind_reuse_lock.c
@@ -8,7 +8,7 @@
#include <sys/socket.h>
#include <skalibs/djbunix.h>
-#include <skalibs/webipc.h>
+#include <skalibs/socket.h>
int ipc_bind_reuse_lock (int s, char const *p, int *fdlock)
{
@@ -24,8 +24,10 @@ int ipc_bind_reuse_lock (int s, char const *p, int *fdlock)
r = fd_lock(fd, 1, 1) ;
if (r < 0) return -1 ;
if (!r) return (errno = EBUSY, -1) ;
+ r = errno ;
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt) ;
- unlink(p) ;
+ errno = r ;
+ unlink_void(p) ;
if (ipc_bind(s, p) < 0) return -1 ;
*fdlock = fd ;
return 0 ;