summaryrefslogtreecommitdiff
path: root/methods/ftp.cc
diff options
context:
space:
mode:
authorMichael Vogt <egon@debian-devbox>2012-03-06 18:10:02 +0100
committerMichael Vogt <egon@debian-devbox>2012-03-06 18:10:02 +0100
commit7296e47e10687e554a4756f65e9c842f88e696e3 (patch)
treece9c6f63729900dcf0d221c2aaafbfef91f34ed4 /methods/ftp.cc
parente2625f67efae93c2c8affff41ce3e5fb9a507f30 (diff)
parentde31189fca11b7de937a64de90bcc050b76f9181 (diff)
merged from lp:~donkult/apt/experimental
Diffstat (limited to 'methods/ftp.cc')
-rw-r--r--methods/ftp.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/methods/ftp.cc b/methods/ftp.cc
index ad8a7b828..d55ac1224 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -77,6 +77,7 @@ FTPConn::FTPConn(URI Srv) : Len(0), ServerFd(-1), DataFd(-1),
{
Debug = _config->FindB("Debug::Acquire::Ftp",false);
PasvAddr = 0;
+ Buffer[0] = '\0';
}
/*}}}*/
// FTPConn::~FTPConn - Destructor /*{{{*/
@@ -621,8 +622,7 @@ bool FTPConn::ExtGoPasv()
}
// Get a new passive address.
- int Res;
- if ((Res = getaddrinfo(IP.c_str(),PStr,&Hints,&PasvAddr)) != 0)
+ if (getaddrinfo(IP.c_str(),PStr,&Hints,&PasvAddr) != 0)
return true;
return true;
@@ -720,14 +720,13 @@ bool FTPConn::CreateDataFd()
DataListenFd = -1;
// Get the information for a listening socket.
- struct addrinfo *BindAddr = 0;
+ struct addrinfo *BindAddr = NULL;
struct addrinfo Hints;
memset(&Hints,0,sizeof(Hints));
Hints.ai_socktype = SOCK_STREAM;
Hints.ai_flags |= AI_PASSIVE;
Hints.ai_family = ((struct sockaddr *)&ServerAddr)->sa_family;
- int Res;
- if ((Res = getaddrinfo(0,"0",&Hints,&BindAddr)) != 0)
+ if (getaddrinfo(0,"0",&Hints,&BindAddr) != 0 || BindAddr == NULL)
return _error->Error(_("getaddrinfo was unable to get a listening socket"));
// Construct the socket