o->tag.seqnum = htole64(journal_file_tag_seqnum(f));
o->tag.epoch = htole64(FSPRG_GetEpoch(f->fsprg_state));
- log_debug("Writing tag %"PRIu64" for epoch %"PRIu64"\n",
+ log_debug("Writing tag %"PRIu64" for epoch %"PRIu64"",
le64toh(o->tag.seqnum),
FSPRG_GetEpoch(f->fsprg_state));
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);
if (r < 0)
return r;
} else {
- if (type >= 0 && o->object.type != type)
+ if (type > OBJECT_UNUSED && o->object.type != type)
return -EBADMSG;
}
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;
if (m)
munmap(m, PAGE_ALIGN(sizeof(FSSHeader)));
- if (fd >= 0)
- close_nointr_nofail(fd);
-
+ safe_close(fd);
free(p);
+
return r;
}