[libvirt] [PATCH] libxl: report correct errno from virNetSocketNewConnectTCP on migration
Jim Fehlig
jfehlig at suse.com
Thu Sep 3 16:26:03 UTC 2015
On 09/03/2015 06:58 AM, Michal Privoznik wrote:
> On 03.09.2015 12:14, Ian Campbell wrote:
>> saved_errno is never written to in this function after it is
>> initialised and it is only used to log the failure from
>> virNetSocketNewConnectTCP masking the real errno from that function.
>>
>> Drop saved_errno and use errno itself.
>>
>> Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
>> ---
>> src/libxl/libxl_migration.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
>> index 39e4a65..e291d71 100644
>> --- a/src/libxl/libxl_migration.c
>> +++ b/src/libxl/libxl_migration.c
>> @@ -480,7 +480,6 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
>> virURIPtr uri = NULL;
>> virNetSocketPtr sock;
>> int sockfd = -1;
>> - int saved_errno = EINVAL;
>> int ret = -1;
>>
>> /* parse dst host:port from uri */
>> @@ -496,7 +495,7 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
>> if (virNetSocketNewConnectTCP(hostname, portstr,
>> AF_UNSPEC,
>> &sock) < 0) {
>> - virReportSystemError(saved_errno,
>> + virReportSystemError(errno,
>> _("unable to connect to '%s:%s'"),
>> hostname, portstr);
>> goto cleanup;
>>
> In fact, virNetSocketNewConnectTCP itself returns meaningful message on
> error. I think this overwriting should be dropped completely.
Agreed. How about the following patch?
Regards,
Jim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libxl-error-overwrite.patch
Type: text/x-diff
Size: 1278 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150903/94eb1af9/attachment-0001.bin>
More information about the libvir-list
mailing list