From: Michal Schmidt Date: Wed, 10 Dec 2014 15:37:29 +0000 (+0100) Subject: journal: consistently allow type==0 to mean "any type" X-Git-Tag: v219~1002 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=2df65e7d964295f2763fae3b8bc3ade5d4e0fbe3 journal: consistently allow type==0 to mean "any type" If type==0 and a non-NULL object were given as arguments to journal_file_hmac_put_object(), its object type check would fail and it would return -EBADMSG. All existing callers use either a positive type or -1. Still, for behavior consistency with journal_file_move_to_object() let's allow type 0 to pass. --- diff --git a/src/journal/journal-authenticate.c b/src/journal/journal-authenticate.c index f9bd686c1..fd3b82134 100644 --- a/src/journal/journal-authenticate.c +++ b/src/journal/journal-authenticate.c @@ -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 > 0 && o->object.type != type) return -EBADMSG; }