summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2019-08-26 09:58:16 -0700
committergVisor bot <gvisor-bot@google.com>2019-08-26 09:59:43 -0700
commitc9c52c024cf20c1c66327171af4287129724326e (patch)
tree42abe6bc98c0fa40316d6a3a62998cc24fcd8d5a /runsc
parenta5d0115943c591173ea322cd1d721c89fc9c442d (diff)
fsgofer_test.go: a socket file path can't be longer than UNIX_MAX_PATH (108)
PiperOrigin-RevId: 265478578
Diffstat (limited to 'runsc')
-rw-r--r--runsc/fsgofer/fsgofer_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/runsc/fsgofer/fsgofer_test.go b/runsc/fsgofer/fsgofer_test.go
index c86beaef1..cbbe71019 100644
--- a/runsc/fsgofer/fsgofer_test.go
+++ b/runsc/fsgofer/fsgofer_test.go
@@ -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)