]> git.saurik.com Git - apt.git/blobdiff - methods/ftp.cc
Add some more symbols to libapt-pkg5.0.symbols
[apt.git] / methods / ftp.cc
index 5fee20f233850a103f8f1343883f47fad6a17501..6a886dd19e0229f54bcf03675e6b9c869f22e79c 100644 (file)
@@ -18,7 +18,6 @@
 #include <config.h>
 
 #include <apt-pkg/fileutl.h>
-#include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/netrc.h>
@@ -745,7 +744,7 @@ bool FTPConn::CreateDataFd()
    }
    
    // Bind and listen
-   if (bind(DataListenFd,BindAddr->ai_addr,BindAddr->ai_addrlen) < 0)
+   if (::bind(DataListenFd,BindAddr->ai_addr,BindAddr->ai_addrlen) < 0)
    {
       freeaddrinfo(BindAddr);
       return _error->Errno("bind",_("Could not bind a socket"));
@@ -950,7 +949,7 @@ bool FTPConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
 // FtpMethod::FtpMethod - Constructor                                  /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-FtpMethod::FtpMethod() : pkgAcqMethod("1.0",SendConfig)
+FtpMethod::FtpMethod() : aptMethod("ftp","1.0",SendConfig)
 {
    signal(SIGTERM,SigTerm);
    signal(SIGINT,SigTerm);
@@ -985,13 +984,10 @@ void FtpMethod::SigTerm(int)
 /* We stash the desired pipeline depth */
 bool FtpMethod::Configuration(string Message)
 {
-   if (pkgAcqMethod::Configuration(Message) == false)
+   if (aptMethod::Configuration(Message) == false)
       return false;
-   
-   TimeOut = _config->FindI("Acquire::Ftp::Timeout",TimeOut);
 
-   // no more active ftp, sorry
-   DropPrivsOrDie();
+   TimeOut = _config->FindI("Acquire::Ftp::Timeout",TimeOut);
 
    return true;
 }
@@ -1072,7 +1068,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
       URIStart(Res);
       
       FailFile = Itm->DestFile;
-      FailFile.c_str();   // Make sure we dont do a malloc in the signal handler
+      FailFile.c_str();   // Make sure we don't do a malloc in the signal handler
       FailFd = Fd.Fd();
       
       bool Missing;
@@ -1090,7 +1086,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
         // If the file is missing we hard fail and delete the destfile
         // otherwise transient fail
         if (Missing == true) {
-           unlink(FailFile.c_str());
+           RemoveFile("ftp", FailFile);
            return false;
         }
         Fail(true);
@@ -1118,9 +1114,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
                                                                        /*}}}*/
 
 int main(int, const char *argv[])
-{ 
-   setlocale(LC_ALL, "");
-
+{
    /* See if we should be come the http client - we do this for http
       proxy urls */
    if (getenv("ftp_proxy") != 0)
@@ -1143,8 +1137,5 @@ int main(int, const char *argv[])
         exit(100);
       }      
    }
-   
-   FtpMethod Mth;
-
-   return Mth.Run();
+   return FtpMethod().Run();
 }