summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-12-03 10:19:21 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2021-02-03 17:36:45 +0100
commitbb553c3884f811792a1d8021ea8396cbe1ec0b23 (patch)
tree5ea5bc20a41cf81f0ffe0fd2c41e68267f51a357
parentcd1f75854824b3db7ba86039463528f834a0838a (diff)
Fail ConfigDir reading if directory listing failed
We were printing an error and hence have non-zero exit code either way, but API wise it makes sense to have this properly reported back to the caller to propagate it down the chain e.g. while parsing #include stanzas.
-rw-r--r--apt-pkg/contrib/configuration.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 931df9f6c..0c98ff304 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -1150,10 +1150,13 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool const &AsSectio
bool ReadConfigDir(Configuration &Conf,const string &Dir,
bool const &AsSectional, unsigned const &Depth)
{
+ _error->PushToStack();
auto const files = GetListOfFilesInDir(Dir, "conf", true, true);
+ auto const successfulList = not _error->PendingError();
+ _error->MergeWithStack();
return std::accumulate(files.cbegin(), files.cend(), true, [&](bool good, auto const &file) {
return ReadConfigFile(Conf, file, AsSectional, Depth) && good;
- });
+ }) && successfulList;
}
/*}}}*/
// MatchAgainstConfig Constructor /*{{{*/