diff --git a/runtime/main.go b/runtime/main.go index 5b2a7f355d8697d9a1c169872c9e0b45f3ab4b8a..e0ce195a9aa57b721351140c9947b723743403c2 100644 --- a/runtime/main.go +++ b/runtime/main.go @@ -582,15 +582,28 @@ func updateEnvAndPostHook(spec *specs.Spec, vdevice dcmi.VDeviceInfo) { } } +func fileCheck(path string) (string, error) { + var err error + path, err = filepath.EvalSymlinks(path) + if err != nil { + return "", err + } + if _, err = mindxcheckutils.RealFileChecker(path, true, true, mindxcheckutils.DefaultSize); err != nil { + hwlog.RunLog.Errorf("RealFileChecker error: %v, path: %v", err, path) + return "", err + } + return path, nil +} + func modifySpecFile(path string) error { stat, err := os.Stat(path) if err != nil { return fmt.Errorf("spec file doesnt exist %s: %v", path, err) } - if _, err = mindxcheckutils.RealFileChecker(path, true, true, mindxcheckutils.DefaultSize); err != nil { + path, err = fileCheck(path) + if err != nil { return err } - jsonFile, err := os.OpenFile(path, os.O_RDWR, stat.Mode()) if err != nil { return fmt.Errorf("cannot open oci spec file %s: %v", path, err)