summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-25 19:58:21 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-26 08:16:35 -0400
commitdfd9cf7f0b257d38f5527989dd9315e767fbe41b (patch)
treef6017fcc5216254514c6c558f53098119d678211 /src
parent7f1f9b4bcbb9398bbede097eb56e33a949afd7ba (diff)
test-journal-flush: avoid predictable names in /var/tmp
Diffstat (limited to 'src')
-rw-r--r--src/journal/test-journal-flush.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/journal/test-journal-flush.c b/src/journal/test-journal-flush.c
index e61e87af10..0ca24e0cb5 100644
--- a/src/journal/test-journal-flush.c
+++ b/src/journal/test-journal-flush.c
@@ -27,13 +27,14 @@
int main(int argc, char *argv[]) {
- char fn[sizeof("/var/tmp/test-journal-flush-")-1 + DECIMAL_STR_MAX(pid_t) + sizeof(".journal")];
+ char dn[] = "/var/tmp/test-journal-flush.XXXXXX", *fn;
JournalFile *new_journal = NULL;
sd_journal *j = NULL;
unsigned n = 0;
int r;
- sprintf(fn, "/var/tmp/test-journal-flush-%lu.journal", (unsigned long) getpid());
+ assert_se(mkdtemp(dn));
+ fn = strappend(dn, "/test.journal");
r = journal_file_open(fn, O_CREAT|O_RDWR, 0644, false, false, NULL, NULL, NULL, &new_journal);
assert_se(r >= 0);
@@ -67,5 +68,7 @@ int main(int argc, char *argv[]) {
journal_file_close(new_journal);
+ assert_se(rmdir(dn) == 0);
+
return 0;
}