From d5e05a4b92955e479b4d2bf29f8c2cfeae517861 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 15 Dec 2020 06:35:41 -0500 Subject: Allow users to specify TMPDIR in containers.conf Currently we hard code TMPDIR environment variable to /var/tmp if it is not set in the Environment. This causes TMPDIR environment variable to be ignored if set in containers.conf. This change now uses the host environment TMPDIR, followed by containers.conf and then hard codes TMPDIR, if it was not set. Signed-off-by: Daniel J Walsh --- cmd/podman/main.go | 5 ----- cmd/podman/root.go | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/podman/main.go b/cmd/podman/main.go index c3aaf84a8..f076d13f3 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -31,11 +31,6 @@ func main() { return } - // Hard code TMPDIR functions to use /var/tmp, if user did not override - if _, ok := os.LookupEnv("TMPDIR"); !ok { - os.Setenv("TMPDIR", "/var/tmp") - } - rootCmd = parseCommands() Execute() diff --git a/cmd/podman/root.go b/cmd/podman/root.go index 0830a62a5..1f613a4c5 100644 --- a/cmd/podman/root.go +++ b/cmd/podman/root.go @@ -178,6 +178,10 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error { return err } } + // Hard code TMPDIR functions to use /var/tmp, if user did not override + if _, ok := os.LookupEnv("TMPDIR"); !ok { + os.Setenv("TMPDIR", "/var/tmp") + } if !registry.IsRemote() { if cmd.Flag("cpu-profile").Changed { -- cgit v1.2.3-54-g00ecf