summaryrefslogtreecommitdiff
path: root/block/nfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/nfs.c')
-rw-r--r--block/nfs.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/block/nfs.c b/block/nfs.c
index 5ae665abd4..76572ae546 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -767,7 +767,15 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
static int nfs_file_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
{
NFSClient *client = bs->opaque;
- return nfs_ftruncate(client->context, client->fh, offset);
+ int ret;
+
+ ret = nfs_ftruncate(client->context, client->fh, offset);
+ if (ret < 0) {
+ error_setg_errno(errp, -ret, "Failed to truncate file");
+ return ret;
+ }
+
+ return 0;
}
/* Note that this will not re-establish a connection with the NFS server