diff options
| author | Julian Andres Klode <jak@debian.org> | 2021-02-09 09:38:48 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2021-02-09 09:38:48 +0000 |
| commit | cb60beb83610783f664da0bbe1cdb7211aaba90f (patch) | |
| tree | a594f98222c256e6cec1a97c87305083823f0c91 /methods/aptmethod.h | |
| parent | 4c3383746f2974be5fdec86616f45fd85948a9aa (diff) | |
| parent | 131d0e3a261076da715102cb79275988cac810d1 (diff) | |
Merge branch 'pu/fuzzerpatches' into 'master'
Various patches uplifted from unfinished fuzzer branches
See merge request apt-team/apt!158
Diffstat (limited to 'methods/aptmethod.h')
| -rw-r--r-- | methods/aptmethod.h | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/methods/aptmethod.h b/methods/aptmethod.h index 7038131cf..bd50e8078 100644 --- a/methods/aptmethod.h +++ b/methods/aptmethod.h @@ -325,7 +325,11 @@ protected: rc = seccomp_load(ctx); if (rc == -EINVAL) - Warning("aptMethod::Configuration: could not load seccomp policy: %s", strerror(-rc)); + { + std::string msg; + strprintf(msg, "aptMethod::Configuration: could not load seccomp policy: %s", strerror(-rc)); + Warning(std::move(msg)); + } else if (rc != 0) return _error->FatalE("aptMethod::Configuration", "could not load seccomp policy: %s", strerror(-rc)); @@ -380,12 +384,17 @@ protected: return true; } - void Warning(const char *Format,...) + void Warning(std::string &&msg) { - va_list args; - va_start(args,Format); - PrintStatus("104 Warning", Format, args); - va_end(args); + std::unordered_map<std::string, std::string> fields; + if (Queue != 0) + fields.emplace("URI", Queue->Uri); + else + fields.emplace("URI", "<UNKNOWN>"); + if (not UsedMirror.empty()) + fields.emplace("UsedMirror", UsedMirror); + fields.emplace("Message", std::move(msg)); + SendMessage("104 Warning", std::move(fields)); } std::vector<std::string> methodNames; @@ -560,14 +569,11 @@ class aptAuthConfMethod : public aptMethod result &= MaybeAddAuth(*authconf, uri); } - if (not _error->empty()) + while (not _error->empty()) { std::string message; - while (not _error->empty()) - { - _error->PopMessage(message); - Warning("%s", message.c_str()); - } + _error->PopMessage(message); + Warning(std::move(message)); } _error->RevertToStack(); |
