added unlinking section to posix socket binding documentation

This commit is contained in:
A1029384756
2024-11-06 20:27:38 -05:00
parent fd442b8678
commit 5be7ac4039

View File

@@ -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 */
}