summaryrefslogtreecommitdiff
path: root/src/journal/sd-journal.c
diff options
context:
space:
mode:
authorFrederic Crozat <fcrozat@suse.com>2012-03-16 11:59:04 +0100
committerLennart Poettering <lennart@poettering.net>2012-03-22 01:09:37 +0100
commit4fd052aede13eb3041277c54ac2f5dee6e6c29cf (patch)
treea78001fa71f8e01e262123dfabebe3a23b41f8b7 /src/journal/sd-journal.c
parent170dcb7bd575f61aa75ce55d7fc0183ace6b8b76 (diff)
add sparse support to detect endianness bug
le16/32/64_t type should be used when storing little-endian value header to integrate with sparse from Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'src/journal/sd-journal.c')
-rw-r--r--src/journal/sd-journal.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 86ac267de4..e9cd26e95c 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -108,7 +108,7 @@ static int same_field(const void *_a, size_t s, const void *_b, size_t t) {
_public_ int sd_journal_add_match(sd_journal *j, const void *data, size_t size) {
Match *m, *after = NULL;
- uint64_t le_hash;
+ le64_t le_hash;
if (!j)
return -EINVAL;
@@ -356,7 +356,7 @@ static int find_location(sd_journal *j, JournalFile *f, direction_t direction, O
Object *c, *d;
uint64_t cp, dp;
- r = journal_file_find_data_object_with_hash(f, m->data, m->size, m->le_hash, &d, &dp);
+ r = journal_file_find_data_object_with_hash(f, m->data, m->size, le64toh(m->le_hash), &d, &dp);
if (r <= 0)
return r;
@@ -1349,7 +1349,8 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
n = journal_file_entry_n_items(o);
for (i = 0; i < n; i++) {
- uint64_t p, l, le_hash;
+ uint64_t p, l;
+ le64_t le_hash;
size_t t;
p = le64toh(o->entry.items[i].object_offset);
@@ -1410,7 +1411,8 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
_public_ int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t *size) {
JournalFile *f;
- uint64_t p, l, n, le_hash;
+ uint64_t p, l, n;
+ le64_t le_hash;
int r;
Object *o;
size_t t;