X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Ftest-journal-verify.c;h=3b181c679493daf62c061afd6bc09fde0e1dc0e0;hp=ad2e2d4c3b2e8d107727cdd33df9e93544fde00c;hb=a55654d598c78f8e084aa6a18fec6eff900c9aed;hpb=2fa4092c2829dd14e50c430ae2f23551d23c6c1d diff --git a/src/journal/test-journal-verify.c b/src/journal/test-journal-verify.c index ad2e2d4c3..3b181c679 100644 --- a/src/journal/test-journal-verify.c +++ b/src/journal/test-journal-verify.c @@ -48,7 +48,7 @@ static void bit_toggle(const char *fn, uint64_t p) { r = pwrite(fd, &b, 1, p/8); assert(r == 1); - close_nointr_nofail(fd); + safe_close(fd); } static int raw_verify(const char *fn, const char *verification_key) { @@ -77,6 +77,10 @@ int main(int argc, char *argv[]) { struct stat st; uint64_t p; + /* journal_file_open requires a valid machine id */ + if (access("/etc/machine-id", F_OK) != 0) + return EXIT_TEST_SKIP; + log_set_max_level(LOG_DEBUG); assert_se(mkdtemp(t)); @@ -130,10 +134,10 @@ int main(int argc, char *argv[]) { for (p = 38448*8+0; p < ((uint64_t) st.st_size * 8); p ++) { bit_toggle("test.journal", p); - log_info("[ %llu+%llu]", (unsigned long long) p / 8, (unsigned long long) p % 8); + log_info("[ %"PRIu64"+%"PRIu64"]", p / 8, p % 8); if (raw_verify("test.journal", verification_key) >= 0) - log_notice(ANSI_HIGHLIGHT_RED_ON ">>>> %llu (bit %llu) can be toggled without detection." ANSI_HIGHLIGHT_OFF, (unsigned long long) p / 8, (unsigned long long) p % 8); + log_notice(ANSI_HIGHLIGHT_RED_ON ">>>> %"PRIu64" (bit %"PRIu64") can be toggled without detection." ANSI_HIGHLIGHT_OFF, p / 8, p % 8); bit_toggle("test.journal", p); }