From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: Levente Kurusa <lkurusa@redhat.com>
Cc: kwolf@redhat.com, alex@alex.org.uk, mst@redhat.com,
luonengjun@huawei.com,
peter huangpeng <peter.huangpeng@huawei.com>,
qemu-devel@nongnu.org, stefanha@redhat.com, pbonzini@redhat.com,
lcapitulino@redhat.com, alex bennee <alex.bennee@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v2 4/4] ivshmem: check the value returned by fstat()
Date: Thu, 7 Aug 2014 09:50:43 +0800 [thread overview]
Message-ID: <53E2DB73.50200@huawei.com> (raw)
In-Reply-To: <889919637.11247423.1407328255674.JavaMail.zimbra@redhat.com>
On 2014/8/6 20:30, Levente Kurusa wrote:
>> The function fstat() may fail, so check its return value.
>>
>> Signed-off-by: zhanghailiang<zhang.zhanghailiang@huawei.com>
>> ---
>> hw/misc/ivshmem.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
>> index 768e528..5d939d2 100644
>> --- a/hw/misc/ivshmem.c
>> +++ b/hw/misc/ivshmem.c
>> @@ -324,7 +324,11 @@ static int check_shm_size(IVShmemState *s, int fd) {
>>
>> struct stat buf;
>>
>> - fstat(fd,&buf);
>> + if (fstat(fd,&buf)< 0) {
>> + fprintf(stderr, "ivshmem: exiting for fstat fd '%d' failed: %s\n",
>> + fd, strerror(errno));
>
> exiting for fstat?
>
> I would go with something like this:
>
> "ivshmem: exiting: fstat on fd %d failed: %s"
>
> ... or something among the lines.
Hmmm, this is more clear, i will change it.Thanks!
prev parent reply other threads:[~2014-08-07 1:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-06 6:15 [Qemu-devel] [PATCH v2 0/4] fix several bugs about use-after-free and an api abuse zhanghailiang
2014-08-06 6:15 ` [Qemu-devel] [PATCH v2 1/4] l2cap: fix access freed memory zhanghailiang
2014-08-06 6:15 ` [Qemu-devel] [PATCH v2 2/4] monitor: " zhanghailiang
2014-08-06 6:15 ` [Qemu-devel] [PATCH v2 3/4] virtio-blk: fix reference a pointer which might be freed zhanghailiang
2014-08-06 6:15 ` [Qemu-devel] [PATCH v2 4/4] ivshmem: check the value returned by fstat() zhanghailiang
2014-08-06 12:30 ` Levente Kurusa
2014-08-07 1:50 ` zhanghailiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53E2DB73.50200@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=alex.bennee@linaro.org \
--cc=alex@alex.org.uk \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=lkurusa@redhat.com \
--cc=luonengjun@huawei.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).