diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-03-24 17:58:06 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-03-24 17:58:06 +0100 |
commit | 4beb315f53061e537b923009e228981bb1e3fa7f (patch) | |
tree | 14abcb7738545cdd8ef9c26a13fbcd6c1784bf8a | |
parent | 3bceb058c0d1890eee923aa014c41ad458f88fb6 (diff) | |
parent | 0004842de7eeac345b614fa0b6bd241af0c4cc34 (diff) |
merged from lp:~mvo/apt/mvo
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | methods/mirror.cc | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog index d1e636a32..3d63fb64e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ apt (0.8.13ubuntu2) UNRELEASED; urgency=low * po/makefile: - add hack to run MSGMERGE again if it segfaults. this is to help powerpc to bootstrap + * mirror method: + - merge fix from Matt Zimmerman, many thanks (LP: #741098) + - do not crash if the mirror file fails to download -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 16 Mar 2011 20:39:21 +0100 diff --git a/methods/mirror.cc b/methods/mirror.cc index e499b054b..00757e61f 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -141,8 +141,10 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) pkgAcquire Fetcher; new pkgAcqFile(&Fetcher, fetch, "", 0, "", "", "", MirrorFile); bool res = (Fetcher.Run() == pkgAcquire::Continue); - if(res) + if(res) { DownloadedMirrorFile = true; + chmod(MirrorFile.c_str(), 0644); + } Fetcher.Shutdown(); if(Debug) @@ -158,6 +160,9 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file) vector<string> content; string line; + if (!FileExists(mirror_file)) + return false; + // read ifstream in(mirror_file.c_str()); while ( !in.eof() ) { @@ -354,8 +359,8 @@ bool MirrorMethod::Fetch(FetchItem *Itm) if(Itm->IndexFile && !DownloadedMirrorFile) { Clean(_config->FindDir("Dir::State::mirrors")); - DownloadMirrorFile(Itm->Uri); - RandomizeMirrorFile(MirrorFile); + if (DownloadMirrorFile(Itm->Uri)) + RandomizeMirrorFile(MirrorFile); } if(AllMirrors.empty()) { |