*/
#include <stddef.h>
#include <dpl/socket/unix_socket.h>
-#include <dpl/log/log.h>
+#include <dpl/log/wrt_log.h>
#include <dpl/exception.h>
#include <new>
#include <sys/socket.h>
int UnixSocket::AllocSpecificDescriptor() const
{
- LogPedantic("Creating UNIX socket...");
+ WrtLogD("Creating UNIX socket...");
// Create new descriptor
int newSocket = socket(AF_UNIX, SOCK_STREAM, 0);
Throw(Exception::CreateFailed);
}
- LogPedantic("UNIX socket created");
+ WrtLogD("UNIX socket created");
// Return new descriptor
return newSocket;
void UnixSocket::Bind(const Address &address)
{
+ char *errstr = NULL;
+ char errbuf[512] = {0,};
// Always remove socket file if any
unlink(address.GetAddress().c_str());
// Always set proper permissions to the socket file
if (chmod(address.GetAddress().c_str(), 0777) < 0) {
- LogError(
- "Error setting permissions to the socket file. Errno " <<
- strerror(errno));
+#ifdef _GNU_SOURCE
+ errstr = strerror_r(errno, errbuf, sizeof(errbuf));
+#else
+ strerror_r(errno, errbuf, sizeof(errbuf));
+ errstr = errbuf;
+#endif
+ WrtLogE(
+ "Error setting permissions to the socket file. Errno %s", errstr);
}
}
}