[parted-devel] [PATCH 2/7] fs: Fix copy-paste error in HFS journal code

Brian C. Lane bcl at redhat.com
Fri Jun 11 21:51:20 BST 2021


---
 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




More information about the parted-devel mailing list