Re: [libvirt] [PATCH V2] libxl: don't overwrite error from virNetSocketNewConnectTCP()
On 03.09.2015 22:55, John Ferlan wrote: > > > On 09/03/2015 01:40 PM, Jim Fehlig wrote: >> Remove redundant error reporting in libxlDomainMigrationPerform(). >> virNetSocketNewConnectTCP() is perfectly capable of reporting >> sensible errors. >> >> Signed-off-by: Jim Fehlig >> --- >> >> V2: >> Actually try to compile the code and find saved_errno is no >> longer used - remove it. >> >> src/libxl/libxl_migration.c | 7 +-- >> 1 file changed, 1 insertion(+), 6 deletions(-) >> > > ACK > > John > > Also noteworthy that virNetSocketNewConnectTCP could overwrite errno > when freeaddrinfo is run in error: or when VIR_FORCE_CLOSE() did it's > thing... > I don't think that either of those overwrites errno. Here's freeaddrinfo() impl that I've found in glibc: void freeaddrinfo (struct addrinfo *ai) { struct addrinfo *p; while (ai != NULL) { p = ai; ai = ai->ai_next; free (p->ai_canonname); free (p); } } And VIR_FORCE_CLOSE() preserves errno too. But nevertheless, ACK stands. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH V2] libxl: don't overwrite error from virNetSocketNewConnectTCP()
On 09/03/2015 02:55 PM, John Ferlan wrote: On 09/03/2015 01:40 PM, Jim Fehlig wrote: Remove redundant error reporting in libxlDomainMigrationPerform(). virNetSocketNewConnectTCP() is perfectly capable of reporting sensible errors. Signed-off-by: Jim Fehlig --- V2: Actually try to compile the code and find saved_errno is no longer used - remove it. src/libxl/libxl_migration.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) ACK Thanks! Pushed now. Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH V2] libxl: don't overwrite error from virNetSocketNewConnectTCP()
On 09/03/2015 01:40 PM, Jim Fehlig wrote: > Remove redundant error reporting in libxlDomainMigrationPerform(). > virNetSocketNewConnectTCP() is perfectly capable of reporting > sensible errors. > > Signed-off-by: Jim Fehlig > --- > > V2: > Actually try to compile the code and find saved_errno is no > longer used - remove it. > > src/libxl/libxl_migration.c | 7 +-- > 1 file changed, 1 insertion(+), 6 deletions(-) > ACK John Also noteworthy that virNetSocketNewConnectTCP could overwrite errno when freeaddrinfo is run in error: or when VIR_FORCE_CLOSE() did it's thing... -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH V2] libxl: don't overwrite error from virNetSocketNewConnectTCP()
Remove redundant error reporting in libxlDomainMigrationPerform(). virNetSocketNewConnectTCP() is perfectly capable of reporting sensible errors. Signed-off-by: Jim Fehlig --- V2: Actually try to compile the code and find saved_errno is no longer used - remove it. src/libxl/libxl_migration.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index 9609e06..0d23e5f 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -472,7 +472,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 */ @@ -487,12 +486,8 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver, /* socket connect to dst host:port */ if (virNetSocketNewConnectTCP(hostname, portstr, AF_UNSPEC, - &sock) < 0) { -virReportSystemError(saved_errno, - _("unable to connect to '%s:%s'"), - hostname, portstr); + &sock) < 0) goto cleanup; -} if (virNetSocketSetBlocking(sock, true) < 0) { virObjectUnref(sock); -- 2.5.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list