diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2003-03-25 17:01:45 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2003-03-25 17:01:45 +0000 |
commit | c151cfc347d29c7934db74aa4c7aeceaab0de83f (patch) | |
tree | e0d9e3ed17c529fe9aff0bf4463ced288fbb54ab /cpukit/libfs/src/dosfs/fat.c | |
parent | 2003-03-25 Till Straumann <strauman@slac.stanford.edu> (diff) | |
download | rtems-c151cfc347d29c7934db74aa4c7aeceaab0de83f.tar.bz2 |
2003-03-25 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
PR 367/filesystem
* src/dosfs/Makefile.am, src/dosfs/fat.c, src/dosfs/fat.h,
src/dosfs/fat_fat_operations.c, src/dosfs/fat_file.c,
src/dosfs/msdos.h, src/dosfs/msdos_dir.c: Some bugs were still
present in the DOSFS implementation:
- FAT12 did not work properly on Big-Endian machines
- Some synchronization and error handling problems were present
- Some legal codings for EOC were not recognized
Diffstat (limited to 'cpukit/libfs/src/dosfs/fat.c')
-rw-r--r-- | cpukit/libfs/src/dosfs/fat.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c index 1b37a22ff5..3c9b10d9f5 100644 --- a/cpukit/libfs/src/dosfs/fat.c +++ b/cpukit/libfs/src/dosfs/fat.c @@ -260,6 +260,16 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry) i >>= 1, vol->sec_log2++); vol->spc = FAT_BR_SECTORS_PER_CLUSTER(boot_rec); + /* + * "sectors per cluster" of zero is invalid + * (and would hang the following loop) + */ + if (vol->spc == 0) + { + rtems_disk_release(vol->dd); + set_errno_and_return_minus_one(EINVAL); + } + for (vol->spc_log2 = 0, i = vol->spc; (i & 1) == 0; i >>= 1, vol->spc_log2++); @@ -526,7 +536,7 @@ fat_init_clusters_chain( if ( buf == NULL ) set_errno_and_return_minus_one( EIO ); - while ((cur_cln & fs_info->vol.mask) != fs_info->vol.eoc_val) + while ((cur_cln & fs_info->vol.mask) < fs_info->vol.eoc_val) { ret = fat_cluster_write(mt_entry, cur_cln, buf); if ( ret == -1 ) |