"path/filepath"
"golang.org/x/sys/unix"
+ "syscall"
)
type Ctx struct {
Spool string
LogPath string
+ UmaskForce *int
Quiet bool
Debug bool
- NotifyFile *FromToYAML
- NotifyFreq *FromToYAML
+ NotifyFile *FromToJSON
+ NotifyFreq *FromToJSON
}
func (ctx *Ctx) FindNode(id string) (*Node, error) {
func (ctx *Ctx) ensureRxDir(nodeId *NodeId) error {
dirPath := filepath.Join(ctx.Spool, nodeId.String(), string(TRx))
- if err := os.MkdirAll(dirPath, os.FileMode(0700)); err != nil {
+ if err := os.MkdirAll(dirPath, os.FileMode(0777)); err != nil {
ctx.LogE("dir-ensure", SDS{"dir": dirPath, "err": err}, "")
return err
}
}
return int64(s.Bavail)*int64(s.Bsize) > want
}
+
+func (ctx *Ctx) Umask() {
+ if ctx.UmaskForce != nil {
+ syscall.Umask(*ctx.UmaskForce)
+ }
+}