Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/sync/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package sync
import (
"math"
"os"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -76,6 +77,8 @@ type Config struct {
Registerer prometheus.Registerer
}

const JFS_UMASK = "JFS_UMASK"

func envList() []string {
return []string{
"ACCESS_KEY",
Expand Down Expand Up @@ -234,6 +237,13 @@ func NewConfigFromCli(c *cli.Context) *Config {
cfg.Env[key] = os.Getenv(key)
}
}
// pass umask to workers
cfg.Env[JFS_UMASK] = strconv.Itoa(utils.GetUmask())

// workers: set umask for the current process
if umask := os.Getenv(JFS_UMASK); umask != "" {
utils.SetUmask(cast.ToInt(umask))
}

return cfg
}
4 changes: 4 additions & 0 deletions pkg/utils/utils_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func GetUmask() int {
return umask
}

func SetUmask(umask int) int {
return syscall.Umask(umask)
}

func ErrnoName(err syscall.Errno) string {
errName := unix.ErrnoName(err)
if errName == "" {
Expand Down
4 changes: 4 additions & 0 deletions pkg/utils/utils_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func GetSysInfo() string {

func GetUmask() int { return 0 }

func SetUmask(umask int) int {
return 0
}

func ErrnoName(err syscall.Errno) string {
return strconv.Itoa(int(err))
}
Loading