summaryrefslogtreecommitdiff
path: root/unix-socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix-socket.c')
-rw-r--r--unix-socket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/unix-socket.c b/unix-socket.c
index 01f119f970..91bd6b89d4 100644
--- a/unix-socket.c
+++ b/unix-socket.c
@@ -99,11 +99,12 @@ int unix_stream_listen(const char *path)
struct sockaddr_un sa;
struct unix_sockaddr_context ctx;
+ unlink(path);
+
if (unix_sockaddr_init(&sa, path, &ctx) < 0)
return -1;
fd = unix_stream_socket();
- unlink(path);
if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0)
goto fail;