Skip to content

Commit

Permalink
Update code based on review comments
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
  • Loading branch information
Michael Crosby committed Jun 25, 2014
1 parent 854bcc0 commit 77dcaac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion namespaces/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nsinit/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
8 changes: 4 additions & 4 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 77dcaac

Please sign in to comment.