Avoid keeping @docker_cli_[UUID] files

Seems that OpenBSD behaves like darwin and requires to unlink all
socket, after it was used.

Tested on OpenBSD 7.4

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
(cherry picked from commit 2c214241fa)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Kirill A. Korinsky 2024-02-08 15:29:13 +01:00 committed by Paweł Gronowski
parent a5937c6043
commit 8715d9a33a
No known key found for this signature in database
GPG Key ID: B85EFCFE26DEF92A
2 changed files with 22 additions and 2 deletions

View File

@ -1,4 +1,4 @@
//go:build !darwin
//go:build !darwin && !openbsd
package socket
@ -15,5 +15,6 @@ func listen(socketname string) (*net.UnixListener, error) {
func onAccept(conn *net.UnixConn, listener *net.UnixListener) {
// do nothing
// while on darwin we would unlink here; on non-darwin the socket is abstract and not present on the filesystem
// while on darwin and OpenBSD we would unlink here;
// on non-darwin the socket is abstract and not present on the filesystem
}

View File

@ -0,0 +1,19 @@
package socket
import (
"net"
"os"
"path/filepath"
"syscall"
)
func listen(socketname string) (*net.UnixListener, error) {
return net.ListenUnix("unix", &net.UnixAddr{
Name: filepath.Join(os.TempDir(), socketname),
Net: "unix",
})
}
func onAccept(conn *net.UnixConn, listener *net.UnixListener) {
syscall.Unlink(listener.Addr().String())
}