X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/45d02095cbd425c741b69810f91bc2282bf9230b..98cc7fd2c1d397623960baf69ae3cec04a87a23e:/methods/connect.cc diff --git a/methods/connect.cc b/methods/connect.cc index 35f4723ce..e2cbf4f5c 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -23,7 +23,7 @@ #include #include #include - +#include #include #include @@ -142,9 +142,9 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd, // Convert the port name/number char ServStr[300]; if (Port != 0) - snprintf(ServStr,sizeof(ServStr),"%u",Port); + snprintf(ServStr,sizeof(ServStr),"%i", Port); else - snprintf(ServStr,sizeof(ServStr),"%s",Service); + snprintf(ServStr,sizeof(ServStr),"%s", Service); /* We used a cached address record.. Yes this is against the spec but the way we have setup our rotating dns suggests that this is more @@ -190,7 +190,7 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd, { if (DefPort != 0) { - snprintf(ServStr,sizeof(ServStr),"%u",DefPort); + snprintf(ServStr, sizeof(ServStr), "%i", DefPort); DefPort = 0; continue; } @@ -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)); }