Skip to content

Commit

Permalink
Merge pull request #11457 from stepancheg:state-file
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 726147631
  • Loading branch information
gvisor-bot committed Feb 12, 2025
2 parents 95ad423 + f0ac6d5 commit c8d5afe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runsc/container/state_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,12 @@ func (s *StateFile) load(v any, opts LoadOpts) error {
}
defer s.UnlockOrDie()

metaBytes, err := os.ReadFile(s.statePath())
path := s.statePath()
metaBytes, err := os.ReadFile(path)
if err != nil {
// Caller of this function relies on error code, we cannot return new error,
// but we need to provide a message with file name.
log.Warningf("Error loading state file %q: %v", path, err)
return err
}
return json.Unmarshal(metaBytes, &v)
Expand Down

0 comments on commit c8d5afe

Please sign in to comment.