summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Reynolds <jrey@us.ibm.com>2018-05-30 11:51:28 -0500
committerJoseph Reynolds <jrey@us.ibm.com>2018-05-31 09:33:25 -0500
commit510eb9cc13a9437f9fc4965c080be8136d5e1320 (patch)
tree5608a089b8f0a12bd8f80d607e3a4e1246734a15
parent6706c1cc30f4f98040d6628f9f15c4513eef2d21 (diff)
downloadphosphor-host-ipmid-510eb9cc13a9437f9fc4965c080be8136d5e1320.tar.gz
phosphor-host-ipmid-510eb9cc13a9437f9fc4965c080be8136d5e1320.zip
Use s.c_str() in log messages
Fixes issues with data passed to phosphor::logging::log(entry()). This is part of a series of commits that resolves openbmc 2905. Tested: static_assert only Change-Id: I9fac771f54e4acbec97ce1360c106b6e3eb4fe9d Signed-off-by: Joseph Reynolds <jrey@us.ibm.com>
-rw-r--r--dcmihandler.cpp2
-rw-r--r--host-interface.cpp2
-rw-r--r--read_fru_data.cpp4
-rw-r--r--sensordatahandler.cpp12
-rw-r--r--softoff/softoff.cpp6
-rw-r--r--transporthandler.cpp2
-rw-r--r--utils.cpp4
7 files changed, 16 insertions, 16 deletions
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index be3e27e..d4f0ff5 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -1110,7 +1110,7 @@ int64_t getPowerReading(sdbusplus::bus::bus& bus)
catch (std::exception& e)
{
log<level::INFO>("Failure to read power value from D-Bus object",
- entry("OBJECT_PATH=%s", objectPath),
+ entry("OBJECT_PATH=%s", objectPath.c_str()),
entry("INTERFACE=%s", SENSOR_VALUE_INTF));
}
return power;
diff --git a/host-interface.cpp b/host-interface.cpp
index 19ca291..8663929 100644
--- a/host-interface.cpp
+++ b/host-interface.cpp
@@ -57,7 +57,7 @@ void Host::execute(Base::Host::Command command)
log<level::DEBUG>("Pushing cmd on to queue",
entry("CONTROL_HOST_CMD=%s",
- convertForMessage(command)));
+ convertForMessage(command).c_str()));
auto cmd = std::make_tuple(ipmiCommand.at(command),
std::bind(&Host::commandStatusHandler,
diff --git a/read_fru_data.cpp b/read_fru_data.cpp
index a1bced9..5133612 100644
--- a/read_fru_data.cpp
+++ b/read_fru_data.cpp
@@ -55,8 +55,8 @@ ipmi::PropertyMap readAllProperties(const std::string& intf,
{
//If property is not found simply return empty value
log<level::ERR>("Error in reading property values from inventory",
- entry("INTERFACE=%s", intf),
- entry("PATH=%s", objPath));
+ entry("INTERFACE=%s", intf.c_str()),
+ entry("PATH=%s", objPath.c_str()));
return properties;
}
reply.read(properties);
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index 20006dc..2d4ac3a 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -44,8 +44,8 @@ ServicePath getServiceAndPath(sdbusplus::bus::bus& bus,
if (mapperResponseMsg.is_method_error())
{
log<level::ERR>("Mapper GetSubTree failed",
- entry("PATH=%s", path),
- entry("INTERFACE=%s", interface));
+ entry("PATH=%s", path.c_str()),
+ entry("INTERFACE=%s", interface.c_str()));
elog<InternalFailure>();
}
@@ -54,8 +54,8 @@ ServicePath getServiceAndPath(sdbusplus::bus::bus& bus,
if (mapperResponse.empty())
{
log<level::ERR>("Invalid mapper response",
- entry("PATH=%s", path),
- entry("INTERFACE=%s", interface));
+ entry("PATH=%s", path.c_str()),
+ entry("INTERFACE=%s", interface.c_str()));
elog<InternalFailure>();
}
@@ -69,8 +69,8 @@ ServicePath getServiceAndPath(sdbusplus::bus::bus& bus,
if (iter == mapperResponse.end())
{
log<level::ERR>("Couldn't find D-Bus path",
- entry("PATH=%s", path),
- entry("INTERFACE=%s", interface));
+ entry("PATH=%s", path.c_str()),
+ entry("INTERFACE=%s", interface.c_str()));
elog<InternalFailure>();
}
return std::make_pair(iter->first, iter->second.begin()->first);
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index f76cd4f..d76750a 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -86,9 +86,9 @@ void SoftPowerOff::hostControlEvent(sdbusplus::message::message& msg)
else
{
log<level::INFO>("Timer started waiting for host to shutdown",
- entry("TIMEOUT_IN_MSEC=%llu",
- duration_cast<milliseconds>(seconds
- (IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS))));
+ entry("TIMEOUT_IN_MSEC=%llu",
+ (duration_cast<milliseconds>(seconds
+ (IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS))).count()));
}
}
else
diff --git a/transporthandler.cpp b/transporthandler.cpp
index bafeb16..98d9573 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -877,7 +877,7 @@ void applyChanges(int channel)
{
log<level::INFO>("Failed to get IP object which matches",
entry("INTERFACE=%s", ipmi::network::IP_INTERFACE),
- entry("MATCH=%s", ethIp));
+ entry("MATCH=%s", ethIp.c_str()));
}
auto systemProperties = ipmi::getAllDbusProperties(
diff --git a/utils.cpp b/utils.cpp
index 4f59f6c..bfe924c 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -543,7 +543,7 @@ uint8_t toPrefix(int addressFamily, const std::string& subnetMask)
if (rc <= 0)
{
log<level::ERR>("inet_pton failed:",
- entry("SUBNETMASK=%s", subnetMask));
+ entry("SUBNETMASK=%s", subnetMask.c_str()));
return 0;
}
@@ -556,7 +556,7 @@ uint8_t toPrefix(int addressFamily, const std::string& subnetMask)
else
{
log<level::ERR>("Invalid Mask",
- entry("SUBNETMASK=%s", subnetMask));
+ entry("SUBNETMASK=%s", subnetMask.c_str()));
return 0;
}
}
OpenPOWER on IntegriCloud