Use s.c_str() in log messages
Part of a series of commits that resolve openbmc 2905
Here is something funny: in item_updater.cpp:300 is a string
and on line 316 it is const char*. It may be confusing to
have the same variable name with two different related types.
Tested: static_assert only
Change-Id: I59556fc184ef1f1047bd8a76062598b7518c36ae
Signed-off-by: Joseph Reynolds <jrey@us.ibm.com>
diff --git a/activation.cpp b/activation.cpp
index 87e5d2b..11c7b32 100755
--- a/activation.cpp
+++ b/activation.cpp
@@ -205,7 +205,7 @@
if (mapperResponseMsg.is_method_error())
{
log<level::ERR>("Error in Get Delete Object",
- entry("VERSIONPATH=%s", path));
+ entry("VERSIONPATH=%s", path.c_str()));
return;
}
std::map<std::string, std::vector<std::string>> mapperResponse;
@@ -213,7 +213,7 @@
if (mapperResponse.begin() == mapperResponse.end())
{
log<level::ERR>("ERROR in reading the mapper response",
- entry("VERSIONPATH=%s", path));
+ entry("VERSIONPATH=%s", path.c_str()));
return;
}
@@ -227,7 +227,7 @@
if (mapperResponseMsg.is_method_error())
{
log<level::ERR>("Error in Deleting image from image manager",
- entry("VERSIONPATH=%s", path));
+ entry("VERSIONPATH=%s", path.c_str()));
return;
}
}
diff --git a/item_updater.cpp b/item_updater.cpp
index ad8f264..a3b1c9c 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -94,7 +94,7 @@
if (pos == std::string::npos)
{
log<level::ERR>("No version id found in object path",
- entry("OBJPATH=%s", path));
+ entry("OBJPATH=%s", path.c_str()));
return;
}
@@ -160,7 +160,7 @@
if (!fs::is_regular_file(pnorTOC))
{
log<level::ERR>("Failed to read pnorTOC.",
- entry("FILENAME=%s", pnorTOC.string()));
+ entry("FILENAME=%s", pnorTOC.c_str()));
ItemUpdater::erase(id);
continue;
}
@@ -170,7 +170,7 @@
if (version.empty())
{
log<level::ERR>("Failed to read version from pnorTOC",
- entry("FILENAME=%s", pnorTOC.string()));
+ entry("FILENAME=%s", pnorTOC.c_str()));
activationState = server::Activation::Activations::Invalid;
}
@@ -178,7 +178,7 @@
if (extendedVersion.empty())
{
log<level::ERR>("Failed to read extendedVersion from pnorTOC",
- entry("FILENAME=%s", pnorTOC.string()));
+ entry("FILENAME=%s", pnorTOC.c_str()));
activationState = server::Activation::Activations::Invalid;
}
@@ -210,7 +210,7 @@
if (!restoreFromFile(id, priority))
{
log<level::ERR>("Unable to restore priority from file.",
- entry("VERSIONID=%s", id));
+ entry("VERSIONID=%s", id.c_str()));
}
activations.find(id)->second->redundancyPriority =
std::make_unique<RedundancyPriority>(
@@ -233,7 +233,7 @@
if (!fs::is_directory(roDir))
{
log<level::ERR>("No corresponding read-only volume found.",
- entry("DIRNAME=%s", roDir));
+ entry("DIRNAME=%s", roDir.c_str()));
ItemUpdater::erase(id);
}
}
@@ -309,7 +309,7 @@
if (reply.is_method_error())
{
log<level::ERR>("Failed to clear read-write partitions",
- entry("SERVICE_FILE=%s", serviceFile));
+ entry("SERVICE_FILE=%s", serviceFile.c_str()));
elog<InternalFailure>();
}
}