summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Reynolds <jrey@us.ibm.com>2018-05-10 15:55:09 -0500
committerJoseph Reynolds <jrey@us.ibm.com>2018-05-30 09:15:54 -0500
commit02653ca867156d01e0784474cbb539ddfc149472 (patch)
tree1866f7c875b1a7c6dbd56435deed205afe93c09a
parent269501c56f6e082a9d5ad8afae291037f5007844 (diff)
downloadphosphor-networkd-02653ca867156d01e0784474cbb539ddfc149472.tar.gz
phosphor-networkd-02653ca867156d01e0784474cbb539ddfc149472.zip
Use s.c_str() in log messages
Partly resolves openbmc/openbmc 2905 Bonus! The new static_assert found a related bug in log.cpp: log("msg", entry("fmt", data, entry("fmt", data))) which should have been: log("msg", entry("fmt", data), entry("fmt", data)) Tested: static_assert only Change-Id: Ie1c550a27f454ef92ee096d812adcc400a1a25cf Signed-off-by: Joseph Reynolds <jrey@us.ibm.com>
-rw-r--r--util.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/util.cpp b/util.cpp
index c4e989a..9527426 100644
--- a/util.cpp
+++ b/util.cpp
@@ -57,7 +57,7 @@ uint8_t toV6Cidr(const std::string& subnetMask)
if (sscanf(str.c_str(), "%hx", &buff) <= 0)
{
log<level::ERR>("Invalid Mask",
- entry("SUBNETMASK=%s", subnetMask));
+ entry("SUBNETMASK=%s", subnetMask.c_str()));
return 0;
}
@@ -72,7 +72,7 @@ uint8_t toV6Cidr(const std::string& subnetMask)
if (((sizeof(buff) * 8) - (__builtin_ctz(buff))) != __builtin_popcount(buff))
{
log<level::ERR>("Invalid Mask",
- entry("SUBNETMASK=%s", subnetMask));
+ entry("SUBNETMASK=%s", subnetMask.c_str()));
return 0;
}
@@ -101,7 +101,7 @@ uint8_t toCidr(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;
}
@@ -114,7 +114,7 @@ uint8_t toCidr(int addressFamily, const std::string& subnetMask)
else
{
log<level::ERR>("Invalid Mask",
- entry("SUBNETMASK=%s", subnetMask));
+ entry("SUBNETMASK=%s", subnetMask.c_str()));
return 0;
}
}
@@ -384,8 +384,8 @@ void deleteInterface(const std::string& intf)
if(status < 0)
{
log<level::ERR>("Unable to delete the interface",
- entry("INTF=%s", intf.c_str(),
- entry("STATUS=%d", status)));
+ entry("INTF=%s", intf.c_str()),
+ entry("STATUS=%d", status));
elog<InternalFailure>();
}
}
@@ -473,8 +473,8 @@ void executeCommandinChildProcess(const char* path, char** args)
}
log<level::ERR>("Unable to execute the command",
- entry("CMD=%s", command.c_str(),
- entry("STATUS=%d", status)));
+ entry("CMD=%s", command.c_str()),
+ entry("STATUS=%d", status));
elog<InternalFailure>();
}
}
OpenPOWER on IntegriCloud