block: use /var/tmp instead of /tmp for -snapshot
If TMPDIR is not specified, the default was to use /tmp for the working copy of the block devices. Update this to /var/tmp instead, so systems using tmp-on-tmpfs don't end up inadvertently using RAM for the block device. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
4b350f1de1
commit
69bef7931e
5
block.c
5
block.c
|
@ -547,8 +547,9 @@ int get_tmp_filename(char *filename, int size)
|
||||||
int fd;
|
int fd;
|
||||||
const char *tmpdir;
|
const char *tmpdir;
|
||||||
tmpdir = getenv("TMPDIR");
|
tmpdir = getenv("TMPDIR");
|
||||||
if (!tmpdir)
|
if (!tmpdir) {
|
||||||
tmpdir = "/tmp";
|
tmpdir = "/var/tmp";
|
||||||
|
}
|
||||||
if (snprintf(filename, size, "%s/vl.XXXXXX", tmpdir) >= size) {
|
if (snprintf(filename, size, "%s/vl.XXXXXX", tmpdir) >= size) {
|
||||||
return -EOVERFLOW;
|
return -EOVERFLOW;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue