diff options
| author | David Kalnischkies <david@kalnischkies.de> | 2022-08-31 16:26:48 +0200 |
|---|---|---|
| committer | David Kalnischkies <david@kalnischkies.de> | 2022-09-02 16:55:45 +0200 |
| commit | 49f9cfba5567cd034bf729a63b3f6e9badd9bc35 (patch) | |
| tree | 3e55a7ca689ddf5258d567e19f118984ceddeb39 /apt-pkg | |
| parent | 6499f7dc842ebd621f11ea01e83ccbe4125a0581 (diff) | |
Report failures back from debSystem::AddStatusFiles
Failing to properly create the status file class should be reported back
to the caller so it can proceed accordingly instead of proceeding into
more failures.
This gives us:
E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory)
E: The package lists or status file could not be parsed or opened.
instead of:
E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory)
E: Could not open file - open (2: No such file or directory)
E: Problem opening
E: The package lists or status file could not be parsed or opened.
and valgrind reporting actions on uninitialised values.
Diffstat (limited to 'apt-pkg')
| -rw-r--r-- | apt-pkg/deb/debsystem.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index c9c6a7e85..65a27f72f 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -335,8 +335,20 @@ signed debSystem::Score(Configuration const &Cnf) /* */ bool debSystem::AddStatusFiles(std::vector<pkgIndexFile *> &List) { - if (d->StatusFile == 0) - d->StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status")); + if (d->StatusFile == nullptr) + { + auto dpkgstatus = _config->FindFile("Dir::State::status"); + _error->PushToStack(); + d->StatusFile = new debStatusIndex(std::move(dpkgstatus)); + bool const errored = _error->PendingError(); + _error->MergeWithStack(); + if (errored) + { + delete d->StatusFile; + d->StatusFile = nullptr; + return false; + } + } List.push_back(d->StatusFile); return true; } |
