Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent panic if fileinfo is nil #4850

Merged
merged 3 commits into from
Oct 12, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check and return error
  • Loading branch information
glinton authored and danielnelson committed Oct 12, 2018
commit 8f67a2ecbb5312913a6d7a01269986cf0c814aaf
4 changes: 2 additions & 2 deletions plugins/inputs/filecount/filecount.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ 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 file == nil {
return fmt.Errorf("Nil file found at %q", path)
if err != nil {
return err
}
if path == basedir {
return nil
Expand Down