fsgofer_test.go: a socket file path can't be longer than UNIX_MAX_PATH (108)

PiperOrigin-RevId: 265478578
This commit is contained in:
Andrei Vagin
2019-08-26 09:59:43 -07:00
committed by gVisor bot
parent a5d0115943
commit c9c52c024c
+9 -1
View File
@@ -635,7 +635,15 @@ func TestAttachInvalidType(t *testing.T) {
t.Fatalf("Mkfifo(%q): %v", fifo, err)
}
socket := filepath.Join(dir, "socket")
dirFile, err := os.Open(dir)
if err != nil {
t.Fatalf("Open(%s): %v", dir, err)
}
defer dirFile.Close()
// Bind a socket via /proc to be sure that a length of a socket path
// is less than UNIX_PATH_MAX.
socket := filepath.Join(fmt.Sprintf("/proc/self/fd/%d", dirFile.Fd()), "socket")
l, err := net.Listen("unix", socket)
if err != nil {
t.Fatalf("net.Listen(unix, %q): %v", socket, err)