diff options
-rw-r--r-- | libpod/oci_conmon_attach_common.go | 9 | ||||
-rw-r--r-- | libpod/oci_conmon_attach_linux.go | 17 |
2 files changed, 17 insertions, 9 deletions
diff --git a/libpod/oci_conmon_attach_common.go b/libpod/oci_conmon_attach_common.go index aa55aa6f5..adc374503 100644 --- a/libpod/oci_conmon_attach_common.go +++ b/libpod/oci_conmon_attach_common.go @@ -29,15 +29,6 @@ const ( AttachPipeStderr = 3 ) -func openUnixSocket(path string) (*net.UnixConn, error) { - fd, err := unix.Open(path, unix.O_PATH, 0) - if err != nil { - return nil, err - } - defer unix.Close(fd) - return net.DialUnix("unixpacket", nil, &net.UnixAddr{Name: fmt.Sprintf("/proc/self/fd/%d", fd), Net: "unixpacket"}) -} - // Attach to the given container. // Does not check if state is appropriate. // started is only required if startContainer is true. diff --git a/libpod/oci_conmon_attach_linux.go b/libpod/oci_conmon_attach_linux.go new file mode 100644 index 000000000..f1aa89d3e --- /dev/null +++ b/libpod/oci_conmon_attach_linux.go @@ -0,0 +1,17 @@ +package libpod + +import ( + "fmt" + "net" + + "golang.org/x/sys/unix" +) + +func openUnixSocket(path string) (*net.UnixConn, error) { + fd, err := unix.Open(path, unix.O_PATH, 0) + if err != nil { + return nil, err + } + defer unix.Close(fd) + return net.DialUnix("unixpacket", nil, &net.UnixAddr{Name: fmt.Sprintf("/proc/self/fd/%d", fd), Net: "unixpacket"}) +} |