From 5990f0f142b8771865293f06309ea48a8c167695 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Thu, 9 Jan 2020 13:57:01 +0900 Subject: rootlessport: remove state dir on exit Signed-off-by: Akihiro Suda --- pkg/rootlessport/rootlessport_linux.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/rootlessport/rootlessport_linux.go b/pkg/rootlessport/rootlessport_linux.go index 655d1a448..88105733f 100644 --- a/pkg/rootlessport/rootlessport_linux.go +++ b/pkg/rootlessport/rootlessport_linux.go @@ -105,6 +105,7 @@ func parent() error { if err != nil { return err } + defer os.RemoveAll(stateDir) driver, err := rkbuiltin.NewParentDriver(&logrusWriter{prefix: "parent: "}, stateDir) if err != nil { return err -- cgit v1.2.3-54-g00ecf From 556cc1fadf9a65da20dcc1e4ef0fa2523850cf7e Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Thu, 9 Jan 2020 14:06:33 +0900 Subject: rootlessport: honor ctr.runtime.config.TmpDir Previously, rootlessport was using /var/tmp as the tmp dir. Signed-off-by: Akihiro Suda --- libpod/networking_linux.go | 1 + pkg/rootlessport/rootlessport_linux.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 06b3fe957..89dac2b5d 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -344,6 +344,7 @@ func (r *Runtime) setupRootlessPortMapping(ctr *Container, netnsPath string) (er NetNSPath: netnsPath, ExitFD: 3, ReadyFD: 4, + TmpDir: ctr.runtime.config.TmpDir, } cfgJSON, err := json.Marshal(cfg) if err != nil { diff --git a/pkg/rootlessport/rootlessport_linux.go b/pkg/rootlessport/rootlessport_linux.go index 88105733f..3e678d33a 100644 --- a/pkg/rootlessport/rootlessport_linux.go +++ b/pkg/rootlessport/rootlessport_linux.go @@ -46,6 +46,7 @@ type Config struct { NetNSPath string ExitFD int ReadyFD int + TmpDir string } func init() { @@ -101,7 +102,7 @@ func parent() error { } // create the parent driver - stateDir, err := ioutil.TempDir("", "rootlessport") + stateDir, err := ioutil.TempDir(cfg.TmpDir, "rootlessport") if err != nil { return err } -- cgit v1.2.3-54-g00ecf