devout: unlink socket pathname before binding

This commit is contained in:
Daniel Barlow 2024-09-05 10:05:13 +01:00
parent 12275f6896
commit 32bf80c6fa
1 changed files with 1 additions and 0 deletions

View File

@ -131,6 +131,7 @@
(fn unix-socket [name] (fn unix-socket [name]
(let [addr (string.pack "=Hz" AF_LOCAL name) (let [addr (string.pack "=Hz" AF_LOCAL name)
fd (check-errno (ll.socket AF_LOCAL SOCK_STREAM 0))] fd (check-errno (ll.socket AF_LOCAL SOCK_STREAM 0))]
(os.remove name)
(check-errno (ll.bind fd addr)) (check-errno (ll.bind fd addr))
(check-errno (ll.listen fd 32)) (check-errno (ll.listen fd 32))
fd)) fd))