teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0064-journal-allow-files-with-no-data-whatsoever.patch

Zbigniew Jędrzejewski-Szmek 43ff24
From ae1d412f96829802688194e6957f75d37da9d7e9 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 43ff24
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Zbigniew Jędrzejewski-Szmek 43ff24
Date: Sun, 30 Mar 2014 14:20:34 -0400
Zbigniew Jędrzejewski-Szmek 43ff24
Subject: [PATCH] journal: allow files with no data whatsoever
Zbigniew Jędrzejewski-Szmek 43ff24
Zbigniew Jędrzejewski-Szmek 43ff24
If a file was opened for writing, and then closed immediately without
Zbigniew Jędrzejewski-Szmek 43ff24
actually writing any entries, on subsequent opening, it would be
Zbigniew Jędrzejewski-Szmek 43ff24
considered "corrupted". This should be totally fine, and even in
Zbigniew Jędrzejewski-Szmek 43ff24
read mode, an empty file can become non-empty later on.
Zbigniew Jędrzejewski-Szmek 43ff24
Zbigniew Jędrzejewski-Szmek 43ff24
(cherry picked from commit b3306e9c3c1e036396bc6bf74555eecea3f45ad9)
Zbigniew Jędrzejewski-Szmek 43ff24
---
Zbigniew Jędrzejewski-Szmek 43ff24
 src/journal/journal-file.c | 6 ------
Zbigniew Jędrzejewski-Szmek 43ff24
 1 file changed, 6 deletions(-)
Zbigniew Jędrzejewski-Szmek 43ff24
Zbigniew Jędrzejewski-Szmek 43ff24
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
Zbigniew Jędrzejewski-Szmek 43ff24
index b3b1ffc3c0..ef54af4558 100644
Zbigniew Jędrzejewski-Szmek 43ff24
--- a/src/journal/journal-file.c
Zbigniew Jędrzejewski-Szmek 43ff24
+++ b/src/journal/journal-file.c
Zbigniew Jędrzejewski-Szmek 43ff24
@@ -271,12 +271,6 @@ static int journal_file_verify_header(JournalFile *f) {
Zbigniew Jędrzejewski-Szmek 43ff24
             !VALID64(le64toh(f->header->entry_array_offset)))
Zbigniew Jędrzejewski-Szmek 43ff24
                 return -ENODATA;
Zbigniew Jędrzejewski-Szmek 43ff24
 
Zbigniew Jędrzejewski-Szmek 43ff24
-        if (le64toh(f->header->data_hash_table_offset) < le64toh(f->header->header_size) ||
Zbigniew Jędrzejewski-Szmek 43ff24
-            le64toh(f->header->field_hash_table_offset) < le64toh(f->header->header_size) ||
Zbigniew Jędrzejewski-Szmek 43ff24
-            le64toh(f->header->tail_object_offset) < le64toh(f->header->header_size) ||
Zbigniew Jędrzejewski-Szmek 43ff24
-            le64toh(f->header->entry_array_offset) < le64toh(f->header->header_size))
Zbigniew Jędrzejewski-Szmek 43ff24
-                return -ENODATA;
Zbigniew Jędrzejewski-Szmek 43ff24
-
Zbigniew Jędrzejewski-Szmek 43ff24
         if (f->writable) {
Zbigniew Jędrzejewski-Szmek 43ff24
                 uint8_t state;
Zbigniew Jędrzejewski-Szmek 43ff24
                 sd_id128_t machine_id;