File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package sync
1919import (
2020 "math"
2121 "os"
22+ "strconv"
2223 "strings"
2324 "time"
2425
@@ -76,6 +77,8 @@ type Config struct {
7677 Registerer prometheus.Registerer
7778}
7879
80+ const JFS_UMASK = "JFS_UMASK"
81+
7982func envList () []string {
8083 return []string {
8184 "ACCESS_KEY" ,
@@ -234,6 +237,13 @@ func NewConfigFromCli(c *cli.Context) *Config {
234237 cfg .Env [key ] = os .Getenv (key )
235238 }
236239 }
240+ // pass umask to workers
241+ cfg .Env [JFS_UMASK ] = strconv .Itoa (utils .GetUmask ())
242+
243+ // workers: set umask for the current process
244+ if umask := os .Getenv (JFS_UMASK ); umask != "" {
245+ utils .SetUmask (cast .ToInt (umask ))
246+ }
237247
238248 return cfg
239249}
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ func GetUmask() int {
6969 return umask
7070}
7171
72+ func SetUmask (umask int ) int {
73+ return syscall .Umask (umask )
74+ }
75+
7276func ErrnoName (err syscall.Errno ) string {
7377 errName := unix .ErrnoName (err )
7478 if errName == "" {
Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ func GetSysInfo() string {
5353
5454func GetUmask () int { return 0 }
5555
56+ func SetUmask (umask int ) int {
57+ return 0
58+ }
59+
5660func ErrnoName (err syscall.Errno ) string {
5761 return strconv .Itoa (int (err ))
5862}
You can’t perform that action at this time.
0 commit comments