Hi,

while reviewing sparse warnings on journal, I found state flag from
journal was sometime stored in uint32_t and even changed endianness,
though its storing type in journal on disk in uint8_t.

Attached patch make sure uint8_t is used in a consistent manner.
-- 
Frederic Crozat <[email protected]>
SUSE
>From d6fd2a17e7259baa976254532a03e526b2d9cc9b Mon Sep 17 00:00:00 2001
From: Frederic Crozat <[email protected]>
Date: Thu, 15 Mar 2012 17:50:03 +0100
Subject: [PATCH] journal: only use uint8_t for state

---
 src/journal/journal-file.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 90aa27e..7d2222d 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -162,7 +162,7 @@ static int journal_file_verify_header(JournalFile *f) {
                 return -ENODATA;
 
         if (f->writable) {
-                uint32_t state;
+                uint8_t state;
                 sd_id128_t machine_id;
                 int r;
 
@@ -1849,7 +1849,7 @@ int journal_file_rotate(JournalFile **f) {
         if (r < 0)
                 return -errno;
 
-        old_file->header->state = le32toh(STATE_ARCHIVED);
+        old_file->header->state = STATE_ARCHIVED;
 
         r = journal_file_open(old_file->path, old_file->flags, old_file->mode, old_file, &new_file);
         journal_file_close(old_file);
-- 
1.7.7

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to