[syslinux:master] ntfs: Check for disk read error during FS probing

syslinux-bot for Shao Miller shao.miller at yrdsb.edu.on.ca
Sat Dec 17 21:19:31 PST 2011


Commit-ID:  5b7ccf9012802cbacdf835dd260e510c8fda944b
Gitweb:     http://www.syslinux.org/commit/5b7ccf9012802cbacdf835dd260e510c8fda944b
Author:     Shao Miller <shao.miller at yrdsb.edu.on.ca>
AuthorDate: Sat, 3 Sep 2011 15:40:45 -0400
Committer:  Paulo Alcantara <pcacjr at gmail.com>
CommitDate: Sun, 11 Sep 2011 04:10:00 +0000

ntfs: Check for disk read error during FS probing

If reading the NTFS BIOS parameter block fails for any reason,
we will not attempt to continue to work towards finding an
NTFS filesystem on the disk/partition.

Signed-off-by: Shao Miller <shao.miller at yrdsb.edu.on.ca>
Signed-off-by: Paulo Alcantara <pcacjr at gmail.com>

---
 core/fs/ntfs/ntfs.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/core/fs/ntfs/ntfs.c b/core/fs/ntfs/ntfs.c
index 86d2e40..03dec41 100644
--- a/core/fs/ntfs/ntfs.c
+++ b/core/fs/ntfs/ntfs.c
@@ -1125,12 +1125,15 @@ err_mrec:
 /* Initialize the filesystem metadata and return blk size in bits */
 static int ntfs_fs_init(struct fs_info *fs)
 {
+    int read_count;
     struct ntfs_bpb ntfs;
     struct ntfs_sb_info *sbi;
     struct disk *disk = fs->fs_dev->disk;
     uint8_t mft_record_shift;
 
-    disk->rdwr_sectors(disk, &ntfs, 0, 1, 0);
+    read_count = disk->rdwr_sectors(disk, &ntfs, 0, 1, 0);
+    if (!read_count)
+	return -1;
 
     /* sanity check */
     if (!ntfs_check_sb_fields(&ntfs))


More information about the Syslinux-commits mailing list