MEDIUM: sock_unix: implement sock_unix_bind_receiver()
This function performs all the bind-related stuff for UNIX sockets that
was previously done in uxst_bind_listener(). There is a very tiny
difference however, which is that previously, in the unlikely event
where listen() would fail, it was still possible to roll back the binding
and rename the backup to the original socket. Now we have to rename it
before calling returning, hence it will be done before calling listen().
However, this doesn't cover any particular use case since listen() has no
reason to fail there (and the rollback is not done for inherited sockets),
that was just done that way as a generic error processing path.
The code is not used yet and is referenced in the uxst proto's ->bind().
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 24ab191..ca84230 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -56,6 +56,7 @@
.l3_addrlen = sizeof(((struct sockaddr_un*)0)->sun_path),/* path len */
.accept = &listener_accept,
.connect = &uxst_connect_server,
+ .bind = sock_unix_bind_receiver,
.listen = uxst_bind_listener,
.enable_all = enable_all_listeners,
.disable_all = disable_all_listeners,