From: Jay Freeman (saurik) Date: Mon, 16 Dec 2013 12:45:40 +0000 (-0800) Subject: Make CreateFileByName() overwrite existing files. X-Git-Url: https://git.saurik.com/hfs.git/commitdiff_plain/ebd32762f47d66428f733a0fa7621d6f2111e7d8 Make CreateFileByName() overwrite existing files. --- diff --git a/fsck_hfs/dfalib/SRepair.c b/fsck_hfs/dfalib/SRepair.c index d83b2e1..5c579ba 100644 --- a/fsck_hfs/dfalib/SRepair.c +++ b/fsck_hfs/dfalib/SRepair.c @@ -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);