Bläddra i källkod

* methods/https.cc:
- cleanup broken downloads properly

Michael Vogt 15 år sedan
förälder
incheckning
db1f14695c
2 ändrade filer med 6 tillägg och 1 borttagningar
  1. 2 0
      debian/changelog
  2. 4 1
      methods/https.cc

+ 2 - 0
debian/changelog

@@ -20,6 +20,8 @@ apt (0.8.16~exp5) experimental; urgency=low
     - ignore only the invalid regexp instead of all options
   * apt-pkg/acquire-item.h, apt-pkg/deb/debmetaindex.cc:
     - fix fetching language information by adding OptionalSubIndexTarget
+  * methods/https.cc:
+    - cleanup broken downloads properly
 
  -- Michael Vogt <mvo@debian.org>  Fri, 05 Aug 2011 10:57:08 +0200
 

+ 4 - 1
methods/https.cc

@@ -270,14 +270,17 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    long curl_servdate;
    curl_easy_getinfo(curl, CURLINFO_FILETIME, &curl_servdate);
 
+   File->Close();
+
    // cleanup
    if(success != 0) 
    {
       _error->Error("%s", curl_errorstr);
+      // unlink, no need keep 401/404 page content in partial/
+      unlink(File->Name().c_str());
       Fail();
       return true;
    }
-   File->Close();
 
    // Timestamp
    struct utimbuf UBuf;