|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [RFC Patch v4 7/9] correct xc_domain_save()'s return value
On 09/22/2014 04:13 PM, Olaf Hering wrote:
> On Mon, Sep 22, Wen Congyang wrote:
>
>> The callbacks may be implemented in libxl, which is another process.
>> xc_domain_save() is a public API, and the caller may forget to set
>> the errno...
>>
>> So we cannot assume that the callbacks has set the errno
>
> Then the caller is using xc_domain_save incorrectly.
> Looks like there is no API documentation, other than the source code.
What about correcting the errno before xc_domain_save() returns:
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index 6e14112..de8974a 100644
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -2188,10 +2188,14 @@ int xc_domain_save(xc_interface *xch, int io_fd,
uint32_t dom, uint32_t max_iter
outbuf_free(&ob_pagebuf);
errno = rc;
+ rc = !!errno;
+ if (errno == -1)
+ /* We cannot get the correct errno */
+ errno = 0;
exit:
DPRINTF("Save exit of domid %u with errno=%d\n", dom, errno);
- return !!errno;
+ return rc;
}
/*
>
> Olaf
> .
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |