summaryrefslogtreecommitdiffstats
path: root/src/fat_dir.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-01-31 17:07:08 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2009-01-31 17:07:08 +0100
commit56d98fd7a229c8839a364a8a194c89c8fa650fff (patch)
treefabc87d58b2ea35831496d5f9762f6b64b481072 /src/fat_dir.c
parent9970a484b6983cbf5659ebf17335b4192065025e (diff)
Use pread() and pwrite() argument style for internal I/O
Diffstat (limited to 'src/fat_dir.c')
-rw-r--r--src/fat_dir.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/fat_dir.c b/src/fat_dir.c
index ed2f930..06ae3ac 100644
--- a/src/fat_dir.c
+++ b/src/fat_dir.c
@@ -380,7 +380,7 @@ static file_data_t *fat_dir(disk_t *disk_car, const partition_t *partition, dir_
{
log_info("FAT: cluster=%u(0x%x), pos=%lu\n",cluster,cluster,(long unsigned)(start/fat_sector_size(fat_header)));
}
- if(disk_car->read(disk_car, cluster_size, buffer_dir+(uint64_t)cluster_size*nbr_cluster, start))
+ if(disk_car->pread(disk_car, buffer_dir + (uint64_t)cluster_size * nbr_cluster, cluster_size, start) != cluster_size)
{
log_error("FAT: Can't read directory cluster.\n");
stop=1;
@@ -446,7 +446,7 @@ static file_data_t *fat1x_rootdir(disk_t *disk_car, const partition_t *partition
unsigned char *buffer_dir;
buffer_dir=(unsigned char*)MALLOC(root_size);
start=partition->part_offset+(uint64_t)((le16(fat_header->reserved)+fat_header->fats*le16(fat_header->fat_length))*disk_car->sector_size);
- if(disk_car->read(disk_car, root_size, buffer_dir, start))
+ if(disk_car->pread(disk_car, buffer_dir, root_size, start) != root_size)
{
log_error("FAT 1x: Can't read root directory.\n");
/* Don't return yet, it may have been a partial read */
@@ -485,8 +485,9 @@ int dir_partition_fat_init(disk_t *disk_car, const partition_t *partition, dir_d
static unsigned char *buffer;
static struct fat_dir_struct *ls;
buffer=(unsigned char*)MALLOC(0x200);
- if(disk_car->read(disk_car,0x200, buffer, partition->part_offset))
+ if(disk_car->pread(disk_car, buffer, 0x200, partition->part_offset) != 0x200)
{
+ log_error("Can't read FAT boot sector.\n");
free(buffer);
return -1;
}
@@ -554,7 +555,7 @@ static int fat_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *
unsigned int toread = block_size;
if (toread > file_size)
toread = file_size;
- if(disk_car->read(disk_car, toread, buffer_file, start)<0)
+ if(disk_car->pread(disk_car, buffer_file, toread, start) != toread)
{
log_error("fat_copy: Can't read cluster %u.\n", cluster);
}