]> git.saurik.com Git - hfs.git/commitdiff
Make CreateFileByName() overwrite existing files.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 16 Dec 2013 12:45:40 +0000 (04:45 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 16 Dec 2013 12:45:40 +0000 (04:45 -0800)
fsck_hfs/dfalib/SRepair.c

index d83b2e19186d5731055b49a3913bcbdec3d4caa2..5c579badd9c645dda40c4d8ef3cca2cdecef5f55 100644 (file)
@@ -5742,6 +5742,9 @@ OSErr CreateFileByName(SGlobPtr GPtr, UInt32 parentID, UInt16 fileType, u_char *
        BuildCatalogKey(parentID, &fName, isHFSPlus, &catKey);
        err = SearchBTreeRecord(GPtr->calculatedCatalogFCB, &catKey, kNoHint, NULL, 
                                                        &catRecord, &recordSize, &hint);
+        if (err == noErr)
+            DeleteCatalogRecordByID(GPtr, catRecord.hfsPlusFile.fileID, false);
+        else
        if (err != fsBTRecordNotFoundErr) {
 #if DEBUG_OVERLAP
                plog ("%s: %s probably exists in dirID = %d (err=%d)\n", __FUNCTION__, fileName, parentID, err);