From: Cyrill Gorcunov Date: Sat, 21 May 2011 12:10:34 +0000 (+0400) Subject: kvm tools, 9p: Test for tuncation result X-Git-Tag: next-20110824~3^2~275 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=683a686595b729863d4b4be0d8833b0f4efb04a5;p=karo-tx-linux.git kvm tools, 9p: Test for tuncation result Without 'ret' usage I get | cyrill@sun kvm $ make | CC virtio/9p.o | virtio/9p.c: In function ‘virtio_p9_wstat’: | virtio/9p.c:448:6: error: variable ‘res’ set but not used [-Werror=unused-but-set-variable] | cc1: all warnings being treated as errors | make: *** [virtio/9p.o] Error 1 so add a basic check for ftruncate result, this eliminate warning and we might need to use 'res' status later in caller code. Signed-off-by: Cyrill Gorcunov Acked-by: Sasha Levin Signed-off-by: Pekka Enberg --- diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c index 56ecd8e3082a..e307592583a1 100644 --- a/tools/kvm/virtio/9p.c +++ b/tools/kvm/virtio/9p.c @@ -445,7 +445,7 @@ static bool virtio_p9_wstat(struct p9_msg *msg, u32 len, struct iovec *iov, u32 struct p9_twstat *twstat = (struct p9_twstat *)msg->msg; struct p9_str *str; struct p9_fid *fid = &p9dev.fids[twstat->fid]; - int res; + int res = 0; if (twstat->stat.length != -1UL) res = ftruncate(fid->fd, twstat->stat.length); @@ -472,7 +472,8 @@ static bool virtio_p9_wstat(struct p9_msg *msg, u32 len, struct iovec *iov, u32 *outlen = VIRTIO_P9_HDR_LEN; set_p9msg_hdr(outmsg, *outlen, P9_RWSTAT, msg->tag); - return true; + + return res == 0; } static bool virtio_p9_remove(struct p9_msg *msg, u32 len, struct iovec *iov, u32 *outlen)