Skip to content

Commit c81a9a2

Browse files
Set umask=0 when creating unix sockets (#743)
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
1 parent cc7da2a commit c81a9a2

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

runner/runner.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ func startListening(connectionType, listenAddr string, port, keepAlive int) (net
7777
network, addr := getNetworkAndAddr(listenAddr, port)
7878
lc := net.ListenConfig{KeepAlive: time.Duration(keepAlive) * time.Second}
7979

80+
oldMask := umask(0)
81+
defer umask(oldMask)
82+
8083
l, err := lc.Listen(context.Background(), network, addr)
8184
if err == nil {
8285
fmt.Println("Started listening for", connectionType, "on", l.Addr().Network(), l.Addr().String())

runner/umask.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//go:build unix
2+
3+
package runner
4+
5+
import "syscall"
6+
7+
var umask = syscall.Umask

runner/umask_fallback.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//go:build !unix
2+
3+
package runner
4+
5+
func umask(_ int) int {
6+
return 0
7+
}

0 commit comments

Comments
 (0)