summaryrefslogtreecommitdiff
path: root/apt-pkg/edsp.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-05-24 16:27:15 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2020-05-25 12:05:00 +0200
commit90a7a5e32643a67f4245460e7659d9dee230e9e7 (patch)
treef2c3fd350652f4186549a0956f950dfde9275d02 /apt-pkg/edsp.cc
parentc77566fd8f21a1a44efb4092c90996d1cc8eaf24 (diff)
Ensure EDSP doesn't use a dangling architecture string
../apt-pkg/edsp.cc:861:23: error: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl] const char *arch = _config->Find("APT::Architecture").c_str(); Compilers are probably optimizing it the way the patch does by hand now. Small string optimisation helps likely as well. Othwise that should have failed left and right as EDSP is used by experimental and such builders to talk to aspcud. Reported-By: clang
Diffstat (limited to 'apt-pkg/edsp.cc')
-rw-r--r--apt-pkg/edsp.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index fe6f55dcb..3f8534234 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -335,9 +335,8 @@ bool EDSP::WriteRequest(pkgDepCache &Cache, FileFd &output,
}
bool Okay = WriteOkay(output, "Request: EDSP 0.5\n");
- const char *arch = _config->Find("APT::Architecture").c_str();
std::vector<string> archs = APT::Configuration::getArchitectures();
- WriteOkay(Okay, output, "Architecture: ", arch, "\n",
+ WriteOkay(Okay, output, "Architecture: ", _config->Find("APT::Architecture").c_str(), "\n",
"Architectures:");
for (std::vector<string>::const_iterator a = archs.begin(); a != archs.end(); ++a)
WriteOkay(Okay, output, " ", *a);
@@ -858,9 +857,8 @@ bool EIPP::WriteRequest(pkgDepCache &Cache, FileFd &output, /*{{{*/
}
bool Okay = WriteOkay(output, "Request: EIPP 0.1\n");
- const char *arch = _config->Find("APT::Architecture").c_str();
std::vector<string> archs = APT::Configuration::getArchitectures();
- WriteOkay(Okay, output, "Architecture: ", arch, "\n",
+ WriteOkay(Okay, output, "Architecture: ", _config->Find("APT::Architecture").c_str(), "\n",
"Architectures:");
for (std::vector<string>::const_iterator a = archs.begin(); a != archs.end(); ++a)
WriteOkay(Okay, output, " ", *a);