fix really hard to trigger bug in ntfs_delete

edge.strict_endians
cha0smaster 2005-11-04 22:43:10 +00:00
parent 5660554d88
commit 5bbb43d947
2 changed files with 15 additions and 4 deletions

View File

@ -58,7 +58,6 @@ xx/xx/2005 - 1.12.2-WIP
- ntfsinfo: dump index attribute keys. (Szaka)
- mkntfs: don't fill the last $MFT cluster with empty MFT records.
This is needed to conform to Windows' format behavior. (Szaka)
10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs.

View File

@ -1241,6 +1241,7 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len)
ntfs_index_context *ictx = NULL;
FILE_NAME_ATTR *fn = NULL;
BOOL looking_for_dos_name = FALSE, looking_for_win32_name = FALSE;
BOOL case_sensitive_match = TRUE;
int err = 0;
ntfs_log_trace("Entering.\n");
@ -1305,8 +1306,9 @@ search:
ntfs_names_are_equal(fn->file_name,
fn->file_name_length, name,
name_len, (fn->file_name_type ==
FILE_NAME_POSIX) ? CASE_SENSITIVE : IGNORE_CASE,
ni->vol->upcase, ni->vol->upcase_len)) {
FILE_NAME_POSIX || case_sensitive_match) ?
CASE_SENSITIVE : IGNORE_CASE, ni->vol->upcase,
ni->vol->upcase_len)) {
if (fn->file_name_type == FILE_NAME_WIN32) {
looking_for_dos_name = TRUE;
ntfs_attr_reinit_search_ctx(actx);
@ -1317,8 +1319,18 @@ search:
break;
}
}
if (errno)
if (errno) {
/*
* If case sensitive search failed, then try once again
* ignoring case.
*/
if (errno == ENOENT && case_sensitive_match) {
case_sensitive_match = FALSE;
ntfs_attr_reinit_search_ctx(actx);
goto search;
}
goto err_out;
}
/* Search for such FILE_NAME in index. */
ictx = ntfs_index_ctx_get(dir_ni, NTFS_INDEX_I30, 4);
if (!ictx)