You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/01/19 15:06:38 UTC
[incubator-servicecomb-service-center] branch master updated:
SCB-255 logrotate bug fix , non write permission, skip (#250)
This is an automated email from the ASF dual-hosted git repository.
littlecui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-service-center.git
The following commit(s) were added to refs/heads/master by this push:
new 0d03db9 SCB-255 logrotate bug fix ,non write permission, skip (#250)
0d03db9 is described below
commit 0d03db92bab7ea9e9d6b334e7de4141036cf255b
Author: aseTo2016 <14...@qq.com>
AuthorDate: Fri Jan 19 23:06:36 2018 +0800
SCB-255 logrotate bug fix ,non write permission, skip (#250)
* [scb255]logrotate bug fix ,non write permission, skip
* [scb255]logrotate bug fix ,non write permission, skip
---
pkg/logrotate/logrotate.go | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pkg/logrotate/logrotate.go b/pkg/logrotate/logrotate.go
index d67b17a..c2e9e93 100644
--- a/pkg/logrotate/logrotate.go
+++ b/pkg/logrotate/logrotate.go
@@ -240,18 +240,24 @@ func LogRotate(path string, MaxFileSize int, MaxBackupCount int) {
}
}
+func isSkip(f os.FileInfo) bool{
+ //dir or non write permission,skip
+ return f.IsDir() || (f.Mode() & 0200 == 0000)
+}
+
//path : where the file will be filtered
//pat : regexp pattern to filter the matched file
func FilterFileList(path, pat string) ([]string, error) {
capacity := 10
//initialize a fileName slice, len=0, cap=10
fileList := make([]string, 0, capacity)
+
err := filepath.Walk(path,
func(pathName string, f os.FileInfo, e error) error {
if f == nil {
return e
}
- if f.IsDir() {
+ if isSkip(f) {
return nil
}
if pat != "" {
--
To stop receiving notification emails like this one, please contact
['"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>'].