libct: rename root to stateDir in struct Container

The name "root" (or "containerRoot") is confusing; one might think it is
the root of container's file system (the directory we chroot into).

Rename to stateDir for clarity.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2023-10-03 13:04:27 -07:00
committed by Aleksa Sarai
parent c89faacc13
commit efbebb39b5
5 changed files with 24 additions and 24 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ func destroy(c *Container) error {
err = ierr
}
}
if rerr := os.RemoveAll(c.root); err == nil {
if rerr := os.RemoveAll(c.stateDir); err == nil {
err = rerr
}
c.initProcess = nil
@@ -200,7 +200,7 @@ func (r *restoredState) transition(s containerState) error {
}
func (r *restoredState) destroy() error {
if _, err := os.Stat(filepath.Join(r.c.root, "checkpoint")); err != nil {
if _, err := os.Stat(filepath.Join(r.c.stateDir, "checkpoint")); err != nil {
if !os.IsNotExist(err) {
return err
}