added unlinking section to posix socket binding documentation

This commit is contained in:
A1029384756
2024-11-06 20:27:38 -05:00
committed by flysand7
parent 826abd6245
commit 943b09a8b1
+6
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 */
}