dosfs: Fix msdos_find_file_in_directory()

For a filename match the entry must match without anything remaining.

Update #2908.
This commit is contained in:
Sebastian Huber
2017-02-13 15:13:02 +01:00
parent 69ae534cbb
commit 04684cbc43
2 changed files with 23 additions and 1 deletions

View File

@@ -1539,7 +1539,7 @@ msdos_find_file_in_directory (
if (lfn_entry || (lfn_checksum != cs))
entry_matched = false;
else {
else if (filename_size_remaining == 0) {
filename_matched = true;
rc = msdos_on_entry_found (
fs_info,

View File

@@ -1071,6 +1071,22 @@ static void test_compatibility( void )
rtems_test_assert( rc == 0 );
}
static void test_end_of_string_matches( void )
{
int rc;
rc = mkdir( MOUNT_DIR "/lib.beam", S_IRWXU | S_IRWXG | S_IRWXO );
rtems_test_assert( rc == 0 );
errno = 0;
rc = unlink( MOUNT_DIR "/proc_lib.beam" );
rtems_test_assert( rc == -1 );
rtems_test_assert( errno == ENOENT );
rc = unlink( MOUNT_DIR "/lib.beam" );
rtems_test_assert( rc == 0 );
}
/*
* Main test method
*/
@@ -1129,6 +1145,8 @@ static void test( void )
"/dev/rdb",
NULL);
test_end_of_string_matches();
rc = unmount( MOUNT_DIR );
rtems_test_assert( rc == 0 );
@@ -1197,6 +1215,8 @@ static void test( void )
"/dev/rdb",
&mount_opts[1]);
test_end_of_string_matches();
rc = unmount( MOUNT_DIR );
rtems_test_assert( rc == 0 );
@@ -1260,6 +1280,8 @@ static void test( void )
"/dev/rdc",
&mount_opts[1]);
test_end_of_string_matches();
rc = unmount( MOUNT_DIR );
rtems_test_assert( rc == 0 );