]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/hfs/hfs_vfsutils.c
xnu-792.22.5.tar.gz
[apple/xnu.git] / bsd / hfs / hfs_vfsutils.c
index 6024b382d54dd1cb1a17255dfb93f92b4d770779..a77c6b1794b93ef73dcb646b0ebaee199d9f59ce 100644 (file)
@@ -747,7 +747,14 @@ overflow_extents(struct filefork *fp)
 {
        u_long blocks;
 
-       if (VTOVCB(FTOV(fp))->vcbSigWord == kHFSPlusSigWord) {
+       //
+       // If the vnode pointer is NULL then we're being called
+       // from hfs_remove_orphans() with a faked-up filefork
+       // and therefore it has to be an HFS+ volume.  Otherwise
+       // we check through the volume header to see what type
+       // of volume we're on.
+       //
+       if (FTOV(fp) == NULL || VTOVCB(FTOV(fp))->vcbSigWord == kHFSPlusSigWord) {
                if (fp->ff_extents[7].blockCount == 0)
                        return (0);
 
@@ -1311,7 +1318,7 @@ hfs_remove_orphans(struct hfsmount * hfsmp)
                                cnode.c_rsrcfork = NULL;
                                fsize = (u_int64_t)dfork.ff_blocks * (u_int64_t)HFSTOVCB(hfsmp)->blockSize;
                                while (fsize > 0) {
-                                       if (fsize > HFS_BIGFILE_SIZE) {
+                                       if (fsize > HFS_BIGFILE_SIZE && overflow_extents(&dfork)) {
                                                fsize -= HFS_BIGFILE_SIZE;
                                        } else {
                                                fsize = 0;