1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-05 17:00:20 +00:00

Vendor update

This commit is contained in:
galal-hussein
2017-10-29 11:41:21 +02:00
parent 60574a70bb
commit 84d02e8b42
427 changed files with 76398 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
// +build !windows
package sockets
import (
"net"
"os"
"syscall"
)
// NewUnixSocket creates a unix socket with the specified path and group.
func NewUnixSocket(path string, gid int) (net.Listener, error) {
if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) {
return nil, err
}
mask := syscall.Umask(0777)
defer syscall.Umask(mask)
l, err := net.Listen("unix", path)
if err != nil {
return nil, err
}
if err := os.Chown(path, 0, gid); err != nil {
l.Close()
return nil, err
}
if err := os.Chmod(path, 0660); err != nil {
l.Close()
return nil, err
}
return l, nil
}