summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-08-04 12:51:34 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2018-04-10 18:59:46 +0200
commit0abbb7c7a4bc745f28e5c8472e4c6ea8d481e030 (patch)
treed9d7f923a98e17f97fb06319ce8b33f2e738e4ea /apt-pkg
parentdb3ef18a0a5024cf6f8749ab5de7252cff14e5ee (diff)
don't hang if multiple sources use unavailable method
APT clients always noticed if a method isn't supported and nowadays generate a message of the form: E: The method driver …/foobar could not be found. N: Is the package apt-transport-foobar installed? This only worked if a single source was using such an unavailable method through as we were registering the failed config the first round and the second would try to send requests to the not started method, which wouldn't work and hang instead (+ hiding the error messages as they would be shown only at the end of the execution). Closes: 870675 (cherry picked from commit e250a8d8d8ef2f8f8c5e2041f7645c49fba7aa36) (cherry picked from commit 281dbc8e481fbaeaf7310e0800468d4d212711b8) LP: #1762766
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 59b1fd3c4..ed0ddf7ac 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -417,13 +417,16 @@ pkgAcquire::MethodConfig *pkgAcquire::GetConfig(string Access)
// Create the new config class
Conf = new MethodConfig;
Conf->Access = Access;
- Conf->Next = Configs;
- Configs = Conf;
// Create the worker to fetch the configuration
Worker Work(Conf);
if (Work.Start() == false)
- return 0;
+ {
+ delete Conf;
+ return nullptr;
+ }
+ Conf->Next = Configs;
+ Configs = Conf;
/* if a method uses DownloadLimit, we switch to SingleInstance mode */
if(_config->FindI("Acquire::"+Access+"::Dl-Limit",0) > 0)