* [PATCH] kvm tools: Plug warning in virtio_p9_wstat()
@ 2011-07-10 12:01 Konstantin Khlebnikov
2011-07-10 12:18 ` Pekka Enberg
0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Khlebnikov @ 2011-07-10 12:01 UTC (permalink / raw)
To: kvm
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@openvz.org>
---
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);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm tools: Plug warning in virtio_p9_wstat()
2011-07-10 12:01 [PATCH] kvm tools: Plug warning in virtio_p9_wstat() Konstantin Khlebnikov
@ 2011-07-10 12:18 ` Pekka Enberg
2011-07-10 17:23 ` Aneesh Kumar K.V
0 siblings, 1 reply; 3+ messages in thread
From: Pekka Enberg @ 2011-07-10 12:18 UTC (permalink / raw)
To: Konstantin Khlebnikov; +Cc: kvm, Asias He, Aneesh Kumar K.V, Sasha Levin
On Sun, Jul 10, 2011 at 3:01 PM, Konstantin Khlebnikov
<khlebnikov@openvz.org> wrote:
> 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@openvz.org>
> ---
> 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? */
There's a
make WERROR=0
to work around the warning. Sasha, Aneesh, shouldn't we propagate an
error to the guest here?
>
> 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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm tools: Plug warning in virtio_p9_wstat()
2011-07-10 12:18 ` Pekka Enberg
@ 2011-07-10 17:23 ` Aneesh Kumar K.V
0 siblings, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2011-07-10 17:23 UTC (permalink / raw)
To: Pekka Enberg, Konstantin Khlebnikov; +Cc: kvm, Asias He, Sasha Levin
On Sun, 10 Jul 2011 15:18:41 +0300, Pekka Enberg <penberg@kernel.org> wrote:
> On Sun, Jul 10, 2011 at 3:01 PM, Konstantin Khlebnikov
> <khlebnikov@openvz.org> wrote:
> > 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@openvz.org>
> > ---
> > 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? */
>
> There's a
>
> make WERROR=0
>
> to work around the warning. Sasha, Aneesh, shouldn't we propagate an
> error to the guest here?
>
Yes we should. We should do an RERROR message to the guest.
I guess other functions in 9p.c is also missing error handling.
-aneesh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-10 17:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-10 12:01 [PATCH] kvm tools: Plug warning in virtio_p9_wstat() Konstantin Khlebnikov
2011-07-10 12:18 ` Pekka Enberg
2011-07-10 17:23 ` Aneesh Kumar K.V
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox