X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/9ce3cfc9309c55cc01018c88c1ca82779fd74431..daf38aff59196e86c28cac84606d48a4bc18d6b0:/methods/ftp.cc diff --git a/methods/ftp.cc b/methods/ftp.cc index 2d05364d5..66787a7be 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -3,7 +3,7 @@ // $Id: ftp.cc,v 1.31.2.1 2004/01/16 18:58:50 mdz Exp $ /* ###################################################################### - FTP Aquire Method - This is the FTP aquire method for APT. + FTP Acquire Method - This is the FTP acquire method for APT. This is a very simple implementation that does not try to optimize at all. Commands are sent syncronously with the FTP server (as the @@ -23,7 +23,11 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -42,6 +46,7 @@ #include "rfc2553emu.h" #include "connect.h" #include "ftp.h" + #include /*}}}*/ @@ -56,9 +61,9 @@ struct AFMap }; #ifndef AF_INET6 -struct AFMap AFMap[] = {{AF_INET,1},{}}; +struct AFMap AFMap[] = {{AF_INET,1},{0, 0}}; #else -struct AFMap AFMap[] = {{AF_INET,1},{AF_INET6,2},{}}; +struct AFMap AFMap[] = {{AF_INET,1},{AF_INET6,2},{0, 0}}; #endif unsigned long TimeOut = 120; @@ -946,7 +951,7 @@ FtpMethod::FtpMethod() : pkgAcqMethod("1.0",SendConfig) /*}}}*/ // FtpMethod::SigTerm - Handle a fatal signal /*{{{*/ // --------------------------------------------------------------------- -/* This closes and timestamps the open file. This is neccessary to get +/* This closes and timestamps the open file. This is necessary to get resume behavoir on user abort */ void FtpMethod::SigTerm(int) { @@ -954,11 +959,11 @@ void FtpMethod::SigTerm(int) _exit(100); // Timestamp - struct timespec times[2]; + struct timeval times[2]; times[0].tv_sec = FailTime; times[1].tv_sec = FailTime; - times[0].tv_nsec = times[1].tv_nsec = 0; - futimens(FailFd, times); + times[0].tv_usec = times[1].tv_usec = 0; + utimes(FailFile.c_str(), times); close(FailFd); @@ -1062,11 +1067,11 @@ bool FtpMethod::Fetch(FetchItem *Itm) Fd.Close(); // Timestamp - struct timespec times[2]; + struct timeval times[2]; times[0].tv_sec = FailTime; times[1].tv_sec = FailTime; - times[0].tv_nsec = times[1].tv_nsec = 0; - futimens(FailFd, times); + times[0].tv_usec = times[1].tv_usec = 0; + utimes(FailFile.c_str(), times); // If the file is missing we hard fail and delete the destfile // otherwise transient fail @@ -1081,11 +1086,11 @@ bool FtpMethod::Fetch(FetchItem *Itm) Res.Size = Fd.Size(); // Timestamp - struct timespec times[2]; + struct timeval times[2]; times[0].tv_sec = FailTime; times[1].tv_sec = FailTime; - times[0].tv_nsec = times[1].tv_nsec = 0; - futimens(Fd.Fd(), times); + times[0].tv_usec = times[1].tv_usec = 0; + utimes(Fd.Name().c_str(), times); FailFd = -1; } @@ -1098,7 +1103,7 @@ bool FtpMethod::Fetch(FetchItem *Itm) } /*}}}*/ -int main(int argc,const char *argv[]) +int main(int, const char *argv[]) { setlocale(LC_ALL, "");