qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] util/error: Save errno from clobbering


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] util/error: Save errno from clobbering
Date: Thu, 07 Nov 2013 13:14:55 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 11/07/2013 12:10 PM, Max Reitz wrote:
> There may be calls to error_setg() and especially error_setg_errno()
> which blindly (and until now wrongly) assume these functions not to
> clobber errno (e.g., they pass errno to error_setg_errno() and return
> -errno afterwards). Instead of trying to find and fix all of these
> constructs, just make sure error_setg() and error_setg_errno() indeed do
> not clobber errno.
> 
> Suggested-by: Eric Blake <address@hidden>
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  util/error.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Reviewed-by: Eric Blake <address@hidden>

I did a quick glance through 'git grep -p -A2 error_set' for any more
culprits beyond the one you just fixed in block.c, and didn't spot any
obvious ones; but there were enough 'goto error' statements where I
didn't check if the code at the error label was depending on sane errno
value; and it is definitely easier for code maintenance if you don't
have to think about whether logging an error will clobber the error.
(Not to mention I've also patched libvirt to have the same paradigm of
logging functions guaranteeing no modification to errno).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]