Skip to content

Commit 2c21424

Browse files
committed
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 <[email protected]>
1 parent 79fa65e commit 2c21424

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

cli-plugins/socket/socket_nodarwin.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !darwin
1+
//go:build !darwin && !openbsd
22

33
package socket
44

@@ -15,5 +15,6 @@ func listen(socketname string) (*net.UnixListener, error) {
1515

1616
func onAccept(conn *net.UnixConn, listener *net.UnixListener) {
1717
// do nothing
18-
// while on darwin we would unlink here; on non-darwin the socket is abstract and not present on the filesystem
18+
// while on darwin and OpenBSD we would unlink here;
19+
// on non-darwin the socket is abstract and not present on the filesystem
1920
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package socket
2+
3+
import (
4+
"net"
5+
"os"
6+
"path/filepath"
7+
"syscall"
8+
)
9+
10+
func listen(socketname string) (*net.UnixListener, error) {
11+
return net.ListenUnix("unix", &net.UnixAddr{
12+
Name: filepath.Join(os.TempDir(), socketname),
13+
Net: "unix",
14+
})
15+
}
16+
17+
func onAccept(conn *net.UnixConn, listener *net.UnixListener) {
18+
syscall.Unlink(listener.Addr().String())
19+
}

0 commit comments

Comments
 (0)