Improve and simplify code with modern C++ features
Change-Id: I83bf5513c2a1f90ba5a59e93c473306864b27d94
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index a127c84..8c58c55 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -101,7 +101,7 @@
m_acceptor.bind(m_endpoint);
m_acceptor.listen(backlog);
- if (::chmod(m_endpoint.path().c_str(), 0666) < 0) {
+ if (::chmod(m_endpoint.path().data(), 0666) < 0) {
BOOST_THROW_EXCEPTION(Error("chmod(" + m_endpoint.path() + ") failed: " + std::strerror(errno)));
}
@@ -113,9 +113,7 @@
UnixStreamChannel::accept(const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onAcceptFailed)
{
- m_acceptor.async_accept(m_socket, bind(&UnixStreamChannel::handleAccept, this,
- boost::asio::placeholders::error,
- onFaceCreated, onAcceptFailed));
+ m_acceptor.async_accept(m_socket, [=] (const auto& e) { this->handleAccept(e, onFaceCreated, onAcceptFailed); });
}
void