Skip to content

Commit

Permalink
Fix collector_whitelist feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Sturm committed Sep 7, 2018
1 parent 1cf637b commit a77f6a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,15 @@ type PathMatchResult struct {

func PathMatch(path string, patternList []string) (PathMatchResult, error) {
result := PathMatchResult{}
if _, err := os.Stat(path); os.IsExist(err) {
if _, err := os.Stat(path); err == nil {
resolvedPath, err := filepath.EvalSymlinks(path)
if err != nil {
return result, err
} else {
result.Path = resolvedPath
}
} else {
return result, err

This comment has been minimized.

Copy link
@mpfz0r

mpfz0r Sep 10, 2018

Contributor

But do we want to throw an error here, just because the file does not exist?
IMHO PathMatch should only do one thing, and that is checking against the patternList.

For non existing configurations we would now get an errors.New("Can not validate binary path")
which is rather misleading.

}

if result.Path != path {
Expand Down

0 comments on commit a77f6a7

Please sign in to comment.