diff options
-rw-r--r-- | uapi_bsd.go | 4 | ||||
-rw-r--r-- | uapi_linux.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/uapi_bsd.go b/uapi_bsd.go index b2a7644..bb16d2c 100644 --- a/uapi_bsd.go +++ b/uapi_bsd.go @@ -150,7 +150,7 @@ func UAPIOpen(name string) (*os.File, error) { // check if path exist - err := os.MkdirAll(socketDirectory, 0700) + err := os.MkdirAll(socketDirectory, 0755) if err != nil && !os.IsExist(err) { return nil, err } @@ -167,6 +167,7 @@ func UAPIOpen(name string) (*os.File, error) { return nil, err } + oldUmask := unix.Umask(0077) listener, err := func() (*net.UnixListener, error) { // initial connection attempt @@ -191,6 +192,7 @@ func UAPIOpen(name string) (*os.File, error) { } return net.ListenUnix("unix", addr) }() + unix.Umask(oldUmask) if err != nil { return nil, err diff --git a/uapi_linux.go b/uapi_linux.go index 5e86628..4b74587 100644 --- a/uapi_linux.go +++ b/uapi_linux.go @@ -147,7 +147,7 @@ func UAPIOpen(name string) (*os.File, error) { // check if path exist - err := os.MkdirAll(socketDirectory, 0700) + err := os.MkdirAll(socketDirectory, 0755) if err != nil && !os.IsExist(err) { return nil, err } @@ -164,6 +164,7 @@ func UAPIOpen(name string) (*os.File, error) { return nil, err } + oldUmask := unix.Umask(0077) listener, err := func() (*net.UnixListener, error) { // initial connection attempt @@ -188,6 +189,7 @@ func UAPIOpen(name string) (*os.File, error) { } return net.ListenUnix("unix", addr) }() + unix.Umask(oldUmask) if err != nil { return nil, err |