summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorottopotto <otto_026@hotmail.com>2016-06-30 17:59:06 +0300
committerLennart Poettering <lennart@poettering.net>2016-06-30 07:59:06 -0700
commit34a8f0811c972aedd812468ae13bf9c18010c267 (patch)
tree2156ad1a1273bfdd22902a08939d539b33a72f24 /src/journal
parent30b42a9a36727ac6a5201d51b6d9cd9c788a559a (diff)
journalctl: Make temporary files directory configurable (#3574)
journalctl: Use env variable TMPDIR to save temporary files
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journal-verify.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index a37316b8f9..f61f158e8a 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -26,6 +26,7 @@
#include "compress.h"
#include "fd-util.h"
#include "fileio.h"
+#include "fs-util.h"
#include "journal-authenticate.h"
#include "journal-def.h"
#include "journal-file.h"
@@ -825,6 +826,8 @@ int journal_file_verify(
int data_fd = -1, entry_fd = -1, entry_array_fd = -1;
unsigned i;
bool found_last = false;
+ _cleanup_free_ char *tmp_dir = NULL;
+
#ifdef HAVE_GCRYPT
uint64_t last_tag = 0;
#endif
@@ -843,19 +846,25 @@ int journal_file_verify(
} else if (f->seal)
return -ENOKEY;
- data_fd = open_tmpfile_unlinkable("/var/tmp", O_RDWR | O_CLOEXEC);
+ r = var_tmp(&tmp_dir);
+ if (r < 0) {
+ log_error_errno(r, "Failed to determine temporary directory: %m");
+ goto fail;
+ }
+
+ data_fd = open_tmpfile_unlinkable(tmp_dir, O_RDWR | O_CLOEXEC);
if (data_fd < 0) {
r = log_error_errno(data_fd, "Failed to create data file: %m");
goto fail;
}
- entry_fd = open_tmpfile_unlinkable("/var/tmp", O_RDWR | O_CLOEXEC);
+ entry_fd = open_tmpfile_unlinkable(tmp_dir, O_RDWR | O_CLOEXEC);
if (entry_fd < 0) {
r = log_error_errno(entry_fd, "Failed to create entry file: %m");
goto fail;
}
- entry_array_fd = open_tmpfile_unlinkable("/var/tmp", O_RDWR | O_CLOEXEC);
+ entry_array_fd = open_tmpfile_unlinkable(tmp_dir, O_RDWR | O_CLOEXEC);
if (entry_array_fd < 0) {
r = log_error_errno(entry_array_fd,
"Failed to create entry array file: %m");