Skip to content

Commit

Permalink
Prevent panic if fileinfo is nil (influxdata#4850)
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored and rgitzel committed Oct 17, 2018
1 parent dffb880 commit c7061e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/inputs/filecount/filecount.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ func absDuration(x time.Duration) time.Duration {
func (fc *FileCount) count(acc telegraf.Accumulator, basedir string, recursive bool) {
numFiles := int64(0)
walkFn := func(path string, file os.FileInfo, err error) error {
if err != nil {
if os.IsNotExist(err) {
return nil
}
return err
}
if path == basedir {
return nil
}
Expand Down

0 comments on commit c7061e9

Please sign in to comment.