summaryrefslogtreecommitdiff
path: root/libpod/runtime_img.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-03-06 07:39:32 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2020-03-06 10:21:37 -0500
commitcb51707f91e683323ba61fca49363a997ed1be1f (patch)
tree360c31e8e4d34083f02798cd51ad0ffc435f3b80 /libpod/runtime_img.go
parentf07e18f05c07026e4544788a1359122c81adcde7 (diff)
downloadpodman-cb51707f91e683323ba61fca49363a997ed1be1f.tar.gz
podman-cb51707f91e683323ba61fca49363a997ed1be1f.tar.bz2
podman-cb51707f91e683323ba61fca49363a997ed1be1f.zip
Allow users to set TMPDIR environment
Some users have small /var/tmp directories and need to be able to specify a different location for temporary files, which includes more space. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/runtime_img.go')
-rw-r--r--libpod/runtime_img.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index 6c45a2300..6ac32878b 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -209,11 +209,11 @@ func (r *Runtime) Import(ctx context.Context, source string, reference string, c
}
// donwloadFromURL downloads an image in the format "https:/example.com/myimage.tar"
-// and temporarily saves in it /var/tmp/importxyz, which is deleted after the image is imported
+// and temporarily saves in it $TMPDIR/importxyz, which is deleted after the image is imported
func downloadFromURL(source string) (string, error) {
fmt.Printf("Downloading from %q\n", source)
- outFile, err := ioutil.TempFile("/var/tmp", "import")
+ outFile, err := ioutil.TempFile(util.Tmpdir(), "import")
if err != nil {
return "", errors.Wrap(err, "error creating file")
}
@@ -234,9 +234,9 @@ func downloadFromURL(source string) (string, error) {
}
// DownloadFromFile reads all of the content from the reader and temporarily
-// saves in it /var/tmp/importxyz, which is deleted after the image is imported
+// saves in it $TMPDIR/importxyz, which is deleted after the image is imported
func DownloadFromFile(reader *os.File) (string, error) {
- outFile, err := ioutil.TempFile("/var/tmp", "import")
+ outFile, err := ioutil.TempFile(util.Tmpdir(), "import")
if err != nil {
return "", errors.Wrap(err, "error creating file")
}