From 943b09a8b126d6e256532781d1016f1cb4733665 Mon Sep 17 00:00:00 2001 From: A1029384756 Date: Wed, 6 Nov 2024 20:27:38 -0500 Subject: [PATCH] added unlinking section to posix socket binding documentation --- core/sys/posix/sys_socket.odin | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/sys/posix/sys_socket.odin b/core/sys/posix/sys_socket.odin index 3c9db5bfa..4dd6074a3 100644 --- a/core/sys/posix/sys_socket.odin +++ b/core/sys/posix/sys_socket.odin @@ -48,6 +48,12 @@ foreign libc { addr.sun_family = .UNIX copy(addr.sun_path[:], "/somepath\x00") + /* + unlink the socket before binding in case + of previous runs not cleaning up the socket + */ + posix.unlink("/somepath") + if posix.bind(sfd, (^posix.sockaddr)(&addr), size_of(addr)) != .OK { /* Handle error */ }