]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/ctx.go
Merge branch 'develop'
[nncp.git] / src / ctx.go
index 03fe80e2cff2c73b05d9437b1c725b8d910beb77..3793bbba6b6808b3c3b9d0630a788682b54e615b 100644 (file)
@@ -25,6 +25,7 @@ import (
        "path/filepath"
 
        "golang.org/x/sys/unix"
+       "syscall"
 )
 
 type Ctx struct {
@@ -35,10 +36,11 @@ 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) {
@@ -113,3 +115,9 @@ func (ctx *Ctx) IsEnoughSpace(want int64) bool {
        }
        return int64(s.Bavail)*int64(s.Bsize) > want
 }
+
+func (ctx *Ctx) Umask() {
+       if ctx.UmaskForce != nil {
+               syscall.Umask(*ctx.UmaskForce)
+       }
+}