Skip to content

Commit

Permalink
fix: extra lock on init for safety (influxdata#10199)
Browse files Browse the repository at this point in the history
  • Loading branch information
MyaLongmire authored Dec 1, 2021
1 parent 69afb14 commit b4ef429
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/snmp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import (
// must init, append path for each directory, load module for every file
// or gosmi will fail without saying why
var m sync.Mutex
var once sync.Once

func LoadMibsFromPath(paths []string, log telegraf.Logger) error {
m.Lock()
defer m.Unlock()
gosmi.Init()
once.Do(gosmi.Init)
var folders []string
for _, mibPath := range paths {
gosmi.AppendPath(mibPath)
Expand Down

0 comments on commit b4ef429

Please sign in to comment.