added support for config files, openbsd, pledge and unveil

This commit is contained in:
ston1th 2018-10-26 17:28:50 +02:00
commit 375933c7bc
14 changed files with 138 additions and 49 deletions

View file

@ -3,6 +3,7 @@
package log
import (
"git.giftfish.de/ston1th/godrop/v2"
stdlog "log"
"os"
"path/filepath"
@ -18,7 +19,13 @@ func InitLogger(dir, file string, d bool) {
if file == "-" {
return
}
f, err := os.OpenFile(filepath.Join(dir, file), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0640)
logfile := filepath.Join(dir, file)
err := godrop.Unveil(logfile, "rwc")
if err != nil {
stdlog.Fatal(err)
return
}
f, err := os.OpenFile(logfile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0640)
if err != nil {
stdlog.Fatal(err)
}