diff options
Diffstat (limited to 'src/journal/test-journal-flush.c')
-rw-r--r-- | src/journal/test-journal-flush.c | 7 |
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; } |