diff options
-rw-r--r-- | block.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -191,8 +191,12 @@ void get_tmp_filename(char *filename, int size) void get_tmp_filename(char *filename, int size) { int fd; + char *tmpdir; /* XXX: race condition possible */ - pstrcpy(filename, size, "/tmp/vl.XXXXXX"); + tmpdir = getenv("TMPDIR"); + if (!tmpdir) + tmpdir = "/tmp"; + snprintf(filename, size, "%s/vl.XXXXXX", tmpdir); fd = mkstemp(filename); close(fd); } |