Skip to content

Commit c07c601

Browse files
committed
fixup! Handling Pausing from freezer state
Avoid a racy Stat call (the filesystem could be removed after the Stat but before the ReadFile). Signed-off-by: W. Trevor King <wking@tremily.us>
1 parent b73aef5 commit c07c601

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

libcontainer/container_linux.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,13 +769,11 @@ func (c *linuxContainer) updateState(process parentProcess) error {
769769

770770
func (c *linuxContainer) checkFreezer() (Status, error) {
771771
path := c.cgroupManager.GetPaths()["freezer"]
772-
if _, err := os.Stat(path); err != nil {
772+
contents, err := ioutil.ReadFile(filepath.Join(path, "freezer.state"))
773+
if err != nil {
773774
if os.IsNotExist(err) {
774775
return Running, nil
775776
}
776-
}
777-
contents, err := ioutil.ReadFile(filepath.Join(path, "freezer.state"))
778-
if err != nil {
779777
return 0, newSystemError(err)
780778
}
781779
freezerstate := string(contents)

0 commit comments

Comments
 (0)