diff --git a/namespaces/exec.go b/namespaces/exec.go index 44efb938d..d62b295fe 100644 --- a/namespaces/exec.go +++ b/namespaces/exec.go @@ -62,7 +62,7 @@ func Exec(container *libcontainer.Config, term Terminal, rootfs, dataPath string Pid1StartTime: started, } - if err := libcontainer.WriteState(dataPath, state); err != nil { + if err := libcontainer.SaveState(dataPath, state); err != nil { command.Process.Kill() command.Wait() return -1, err diff --git a/nsinit/exec.go b/nsinit/exec.go index b1b36c135..c58c30664 100644 --- a/nsinit/exec.go +++ b/nsinit/exec.go @@ -26,7 +26,7 @@ func execAction(context *cli.Context) { log.Fatal(err) } - state, err := libcontainer.LoadState(dataPath) + state, err := libcontainer.GetState(dataPath) if err != nil && !os.IsNotExist(err) { log.Fatalf("unable to read state.json: %s", err) } diff --git a/state.go b/state.go index 330f8195b..1f05d4c07 100644 --- a/state.go +++ b/state.go @@ -14,9 +14,9 @@ type State struct { Pid1StartTime string `json:"pid1_start_time,omitempty"` } -// WriteState writes the container's runtime state to a state.json file +// SaveState writes the container's runtime state to a state.json file // in the specified path -func WriteState(basePath string, state *State) error { +func SaveState(basePath string, state *State) error { f, err := os.Create(filepath.Join(basePath, "state.json")) if err != nil { return err @@ -26,8 +26,8 @@ func WriteState(basePath string, state *State) error { return json.NewEncoder(f).Encode(state) } -// LoadState reads the state.json file for a running container -func LoadState(basePath string) (*State, error) { +// GetState reads the state.json file for a running container +func GetState(basePath string) (*State, error) { f, err := os.Open(filepath.Join(basePath, "state.json")) if err != nil { return nil, err