mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 18:14:24 +08:00
add support for read errors in free disk space calculation (szaka)
This commit is contained in:
parent
188cbd9a41
commit
18dec0543d
@ -151,13 +151,13 @@ static long ntfs_fuse_get_nr_free_mft_records(ntfs_volume *vol)
|
||||
return ctx->free_mft;
|
||||
buf = ntfs_malloc(vol->cluster_size);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
return -errno;
|
||||
while (1) {
|
||||
int i, j;
|
||||
|
||||
br = ntfs_attr_pread(vol->mftbmp_na, total,
|
||||
vol->cluster_size, buf);
|
||||
if (!br)
|
||||
if (br <= 0)
|
||||
break;
|
||||
total += br;
|
||||
for (i = 0; i < br; i++)
|
||||
@ -166,7 +166,7 @@ static long ntfs_fuse_get_nr_free_mft_records(ntfs_volume *vol)
|
||||
nr_free++;
|
||||
}
|
||||
free(buf);
|
||||
if (!total)
|
||||
if (!total || br < 0)
|
||||
return -errno;
|
||||
ctx->free_mft = nr_free;
|
||||
ctx->state &= ~(NF_FreeMFTOutdate);
|
||||
@ -183,13 +183,13 @@ static long ntfs_fuse_get_nr_free_clusters(ntfs_volume *vol)
|
||||
return ctx->free_clusters;
|
||||
buf = ntfs_malloc(vol->cluster_size);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
return -errno;
|
||||
while (1) {
|
||||
int i, j;
|
||||
|
||||
br = ntfs_attr_pread(vol->lcnbmp_na, total,
|
||||
vol->cluster_size, buf);
|
||||
if (!br)
|
||||
if (br <= 0)
|
||||
break;
|
||||
total += br;
|
||||
for (i = 0; i < br; i++)
|
||||
@ -198,7 +198,7 @@ static long ntfs_fuse_get_nr_free_clusters(ntfs_volume *vol)
|
||||
nr_free++;
|
||||
}
|
||||
free(buf);
|
||||
if (!total)
|
||||
if (!total || br < 0)
|
||||
return -errno;
|
||||
ctx->free_clusters = nr_free;
|
||||
ctx->state &= ~(NF_FreeClustersOutdate);
|
||||
|
Loading…
Reference in New Issue
Block a user