From cb3f240f4466ee9db61d67353ff2e08c982ba1d1 Mon Sep 17 00:00:00 2001 From: GuyCheung Date: Tue, 21 Jun 2016 15:52:31 +0800 Subject: [PATCH] add os.Chmod when create log file --- logs/file.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/logs/file.go b/logs/file.go index 7798a221..beaa9171 100644 --- a/logs/file.go +++ b/logs/file.go @@ -159,6 +159,10 @@ func (w *fileLogWriter) createLogFile() (*os.File, error) { return nil, err } fd, err := os.OpenFile(w.Filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, os.FileMode(perm)) + if err == nil { + // Make sure file perm is user set perm cause of `os.OpenFile` will obey umask + os.Chmod(w.Filename, w.Perm) + } return fd, err }