diff options
author | Matt Wu <matt@ext2fsd.com> | 2016-08-12 12:30:41 +0300 |
---|---|---|
committer | Matt Wu <matt@ext2fsd.com> | 2016-08-12 13:30:58 +0300 |
commit | 208ce02e8be4a1b9564b69c3a153cf51ec7a5cd8 (patch) | |
tree | a868854eeb320989883168100bcc33356f3a0545 /Ext3Fsd | |
parent | 24f59ceae511fa41411328ad695babc1ba0cca64 (diff) |
FIXME: return value corrected for file open
When file does exist but doesn't match the requested file
attribute, Ext2Fsd should stop the search and then return
FILE/PATH-NOT-FOUND or IS_DIR or NOT_DIR error to system.
Diffstat (limited to 'Ext3Fsd')
-rwxr-xr-x | Ext3Fsd/create.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Ext3Fsd/create.c b/Ext3Fsd/create.c index 69a1ac0..f620bf5 100755 --- a/Ext3Fsd/create.c +++ b/Ext3Fsd/create.c @@ -346,8 +346,9 @@ Ext2LookupFile ( } /* is a directory expected ? */ - if (FullName->Buffer[End - 1] == L'\\') { + while (FullName->Buffer[End - 1] == L'\\') { bDirectory = TRUE; + End -= 1; } /* loop with every sub name */ @@ -868,13 +869,17 @@ McbExisting: PathName = FileName; Mcb = NULL; - if (PathName.Buffer[PathName.Length/2 - 1] == L'\\') { - if (DirectoryFile) { - PathName.Length -=2; - PathName.Buffer[PathName.Length/2] = 0; - } else { - DirectoryFile = TRUE; - } + /* here we've found the target file, but it's not matched. */ + if (STATUS_OBJECT_NAME_NOT_FOUND != Status && + STATUS_NO_SUCH_FILE != Status) { + __leave; + } + + while (PathName.Length > 0 && + PathName.Buffer[PathName.Length/2 - 1] == L'\\') { + DirectoryFile = TRUE; + PathName.Length -= 2; + PathName.Buffer[PathName.Length / 2] = 0; } if (!ParentMcb) { @@ -914,7 +919,8 @@ Dissecting: /* quit name resolving loop */ if (!NT_SUCCESS(Status)) { - if (Status == STATUS_NO_SUCH_FILE && RemainName.Length != 0) { + if (Status == STATUS_NO_SUCH_FILE || + Status == STATUS_OBJECT_NAME_NOT_FOUND) { Status = STATUS_OBJECT_PATH_NOT_FOUND; } __leave; |