Handle nil os.FileInfo in filepath.Walk

closes #2466
This commit is contained in:
Cameron Sparr 2017-02-23 13:45:36 +00:00
parent b9457a1092
commit 9e810ac463
No known key found for this signature in database
GPG Key ID: 19E67263DCB25D0F
2 changed files with 5 additions and 0 deletions

View File

@ -66,6 +66,7 @@ be deprecated eventually.
- [#2380](https://github.com/influxdata/telegraf/issues/2380): buffer_size field value is negative number from "internal" plugin. - [#2380](https://github.com/influxdata/telegraf/issues/2380): buffer_size field value is negative number from "internal" plugin.
- [#2414](https://github.com/influxdata/telegraf/issues/2414): Missing error handling in the MySQL plugin leads to segmentation violation. - [#2414](https://github.com/influxdata/telegraf/issues/2414): Missing error handling in the MySQL plugin leads to segmentation violation.
- [#2178](https://github.com/influxdata/telegraf/issues/2178): logparser: regexp with lookahead. - [#2178](https://github.com/influxdata/telegraf/issues/2178): logparser: regexp with lookahead.
- [#2466](https://github.com/influxdata/telegraf/issues/2466): Telegraf can crash in LoadDirectory on 0600 files.
## v1.2.1 [2017-02-01] ## v1.2.1 [2017-02-01]

View File

@ -505,6 +505,10 @@ func PrintOutputConfig(name string) error {
func (c *Config) LoadDirectory(path string) error { func (c *Config) LoadDirectory(path string) error {
walkfn := func(thispath string, info os.FileInfo, _ error) error { walkfn := func(thispath string, info os.FileInfo, _ error) error {
if info == nil {
log.Printf("W! Telegraf is not permitted to read %s", thispath)
return nil
}
if info.IsDir() { if info.IsDir() {
return nil return nil
} }