From 3c088a417ecc3f77de95d00f1bbdd04316d069db Mon Sep 17 00:00:00 2001 From: Jan Olszak Date: Mon, 10 Dec 2012 09:16:07 +0100 Subject: [PATCH] [Prevent] Handle chmod return value [Issue#] Return value not handled. [Bug] N/A [Cause] N/A [Solution] Log error on chmod fail. [Verification] Build commons. Change-Id: I7196aa7da0307993a49812e29a6ff6a7189c8b86 --- modules/socket/src/unix_socket.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/socket/src/unix_socket.cpp b/modules/socket/src/unix_socket.cpp index 29fae2b..3dd905c 100644 --- a/modules/socket/src/unix_socket.cpp +++ b/modules/socket/src/unix_socket.cpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace DPL { @@ -102,8 +103,9 @@ void UnixSocket::Bind(const Address &address) GenericSocket::Bind(address); // Always set proper permissions to the socket file - chmod(address.GetAddress().c_str(), 0777); + if(chmod(address.GetAddress().c_str(), 0777)<0){ + LogError("Error setting permissions to the socket file. Errno " << strerror(errno)); + } } - } } // namespace DPL -- 2.7.4