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 <ebl...@redhat.com>
> Signed-off-by: Max Reitz <mre...@redhat.com>
> ---
>  util/error.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Reviewed-by: Eric Blake <ebl...@redhat.com>

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