From acb5300bfc37f8b8c217758e83a31b7ecca84f4a Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 10 Jun 2021 15:45:57 -0700
Subject: [PATCH 08/13] fs: Fix copy-paste error in HFS journal code
---
libparted/fs/r/hfs/journal.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libparted/fs/r/hfs/journal.c b/libparted/fs/r/hfs/journal.c
index 862d3d3..c7cd009 100644
--- a/libparted/fs/r/hfs/journal.c
+++ b/libparted/fs/r/hfs/journal.c
@@ -337,12 +337,14 @@ hfsj_replay_journal(PedFileSystem* fs)
}
jh->checksum = HFS_CPU_TO_32(cksum, is_le);
- /* The 2 following test are in the XNU Darwin source code */
- /* so I assume they're needed */
+ /* https://github.com/apple-opensource/hfs/blob/master/core/hfs_journal.c#L1167
+ * indicates that this is:
+ * wrap the start ptr if it points to the very end of the journal
+ */
if (jh->start == jh->size)
jh->start = HFS_CPU_TO_64(PED_SECTOR_SIZE_DEFAULT, is_le);
if (jh->end == jh->size)
- jh->start = HFS_CPU_TO_64(PED_SECTOR_SIZE_DEFAULT, is_le);
+ jh->end = HFS_CPU_TO_64(PED_SECTOR_SIZE_DEFAULT, is_le);
if (jh->start == jh->end)
return 1;
--
2.31.1