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


Reply via email to