Fix: throw correct error in read config

This commit is contained in:
gVisor bot 2019-11-12 10:09:12 +08:00
parent a438900a2e
commit 45b938ea42

View file

@ -121,11 +121,11 @@ func readRawConfig(path string) ([]byte, error) {
} }
path = path[:len(path)-5] + ".yml" path = path[:len(path)-5] + ".yml"
if _, err = os.Stat(path); err == nil { if _, fallbackErr := os.Stat(path); fallbackErr == nil {
return ioutil.ReadFile(path) return ioutil.ReadFile(path)
} }
return data, nil return data, err
} }
func readConfig(path string) (*rawConfig, error) { func readConfig(path string) (*rawConfig, error) {