X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournal-authenticate.c;h=b3e2601c4e18976e9a85dd85a12dfb8c81b77c75;hb=fc07d5d3a982e59d984d6be54342a18028faf7be;hp=f416b79a34ca3962c317c04e7e3f72aeda05f935;hpb=9f6445e34a57c270f013c9416c123e56261553dd;p=elogind.git diff --git a/src/journal/journal-authenticate.c b/src/journal/journal-authenticate.c index f416b79a3..b3e2601c4 100644 --- a/src/journal/journal-authenticate.c +++ b/src/journal/journal-authenticate.c @@ -229,7 +229,7 @@ int journal_file_maybe_append_tag(JournalFile *f, uint64_t realtime) { return 0; } -int journal_file_hmac_put_object(JournalFile *f, int type, Object *o, uint64_t p) { +int journal_file_hmac_put_object(JournalFile *f, ObjectType type, Object *o, uint64_t p) { int r; assert(f); @@ -246,7 +246,7 @@ int journal_file_hmac_put_object(JournalFile *f, int type, Object *o, uint64_t p if (r < 0) return r; } else { - if (type >= 0 && o->object.type != type) + if (type > OBJECT_UNUSED && o->object.type != type) return -EBADMSG; } @@ -339,7 +339,7 @@ int journal_file_fss_load(JournalFile *f) { fd = open(p, O_RDWR|O_CLOEXEC|O_NOCTTY, 0600); if (fd < 0) { if (errno != ENOENT) - log_error("Failed to open %s: %m", p); + log_error_errno(errno, "Failed to open %s: %m", p); r = -errno; goto finish; @@ -418,10 +418,9 @@ finish: if (m) munmap(m, PAGE_ALIGN(sizeof(FSSHeader))); - if (fd >= 0) - close_nointr_nofail(fd); - + safe_close(fd); free(p); + return r; }