From 69c2ecbdc937e3c73fe67d3c9bce12a80d3ec7ec Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 10 Mar 2013 12:24:13 +0100 Subject: various simple changes to fix cppcheck warnings --- methods/rfc2553emu.cc | 2 -- 1 file changed, 2 deletions(-) (limited to 'methods') diff --git a/methods/rfc2553emu.cc b/methods/rfc2553emu.cc index f00e85889..372882769 100644 --- a/methods/rfc2553emu.cc +++ b/methods/rfc2553emu.cc @@ -154,11 +154,9 @@ int getaddrinfo(const char *nodename, const char *servname, /* */ void freeaddrinfo(struct addrinfo *ai) { - struct addrinfo *Tmp; while (ai != 0) { free(ai->ai_addr); - Tmp = ai; ai = ai->ai_next; free(ai); } -- cgit v1.2.3 From 2f5b615169aef2d9c74bb337af229dee2dce595e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 15 Mar 2013 14:17:01 +0100 Subject: * apt-pkg/indexcopy.cc: - rename RunGPGV to ExecGPGV and move it to apt-pkg/contrib/gpgv.cc --- methods/gpgv.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'methods') diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 25ba0d063..98381b845 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -72,7 +73,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, else if (pid == 0) { _error->PushToStack(); - bool const success = SigVerify::RunGPGV(outfile, file, 3, fd); + bool const success = ExecGPGV(outfile, file, 3, fd); if (success == false) { string errmsg; -- cgit v1.2.3 From 99ed26d32226f0dffe5a37fb78c5588f9d9ecfd5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 15 Mar 2013 14:29:46 +0100 Subject: * apt-pkg/contrib/gpgv.cc: - ExecGPGV is a method which should never return, so mark it as such and fix the inconsistency of returning in error cases --- methods/gpgv.cc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'methods') diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 98381b845..3f814b9f0 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -71,19 +71,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, if (pid < 0) return string("Couldn't spawn new process") + strerror(errno); else if (pid == 0) - { - _error->PushToStack(); - bool const success = ExecGPGV(outfile, file, 3, fd); - if (success == false) - { - string errmsg; - _error->PopMessage(errmsg); - _error->RevertToStack(); - return errmsg; - } - _error->RevertToStack(); - exit(111); - } + ExecGPGV(outfile, file, 3, fd); close(fd[1]); FILE *pipein = fdopen(fd[0], "r"); -- cgit v1.2.3 From 945d2a8aeecf844137843265e72d7991f77c3353 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 21 Mar 2013 16:18:58 +0100 Subject: merge patch from Colin to fix error message from getaddrinfo() (#703603) --- methods/connect.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'methods') diff --git a/methods/connect.cc b/methods/connect.cc index 9a092a43c..3573d3cbf 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -197,6 +197,9 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd, return _error->Error(_("Temporary failure resolving '%s'"), Host.c_str()); } + if (Res == EAI_SYSTEM) + return _error->Error(_("System error resolving '%s:%s' (%s)"), + Host.c_str(),ServStr,strerror(errno)); return _error->Error(_("Something wicked happened resolving '%s:%s' (%i - %s)"), Host.c_str(),ServStr,Res,gai_strerror(Res)); } -- cgit v1.2.3 From 45d02095cbd425c741b69810f91bc2282bf9230b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Mar 2013 21:46:53 +0100 Subject: add new config options "Acquire::ForceIPv4" and "Acquire::ForceIPv6" to allow focing one or the other (closes: #611891) --- methods/connect.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'methods') diff --git a/methods/connect.cc b/methods/connect.cc index 3573d3cbf..35f4723ce 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -167,6 +168,13 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd, Hints.ai_flags = AI_ADDRCONFIG; Hints.ai_protocol = 0; + if(_config->FindB("Acquire::ForceIPv4", false) == true) + Hints.ai_family = AF_INET; + else if(_config->FindB("Acquire::ForceIPv6", false) == true) + Hints.ai_family = AF_INET6; + else + Hints.ai_family = AF_UNSPEC; + // if we couldn't resolve the host before, we don't try now if(bad_addr.find(Host) != bad_addr.end()) return _error->Error(_("Could not resolve '%s'"),Host.c_str()); -- cgit v1.2.3 From 5cf466f44ef3eeefbdabc95e1b369bad8889f899 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 25 Mar 2013 09:03:48 +0100 Subject: * methods/connect.cc: - use Errno() instead of strerror(), thanks to David Kalnischk --- methods/connect.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'methods') diff --git a/methods/connect.cc b/methods/connect.cc index 35f4723ce..fc7a72ee9 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -206,8 +206,8 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd, Host.c_str()); } if (Res == EAI_SYSTEM) - return _error->Error(_("System error resolving '%s:%s' (%s)"), - Host.c_str(),ServStr,strerror(errno)); + return _error->Errno("getaddrinfo", _("System error resolving '%s:%s'"), + Host.c_str(),ServStr); return _error->Error(_("Something wicked happened resolving '%s:%s' (%i - %s)"), Host.c_str(),ServStr,Res,gai_strerror(Res)); } -- cgit v1.2.3