[PATCH] kvm tools: Plug warning in virtio_p9_wstat()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



glibc declare ftruncate() with attribute warn_unused_result, so result must be "checked", otherwise we get:

virtio/9p.c:487:6: error: variable ‘res’ set but not used [-Werror=unused-but-set-variable]
or
virtio/9p.c:496:12: error: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Werror=unused-result]

Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx>
---
 tools/kvm/virtio/9p.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c
index d927688..4586f66 100644
--- a/tools/kvm/virtio/9p.c
+++ b/tools/kvm/virtio/9p.c
@@ -495,6 +495,7 @@ static void virtio_p9_wstat(struct p9_dev *p9dev,
 
 	if (wstat.length != -1UL)
 		res = ftruncate(fid->fd, wstat.length);
+	(void)res; /* To plug the warning. FIXME what if ftruncate fails? */
 
 	if (wstat.mode != -1U)
 		chmod(fid->abs_path, wstat.mode & 0xFFFF);

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux