[Prevent] Handle chmod return value
authorJan Olszak <j.olszak@samsung.com>
Mon, 10 Dec 2012 08:16:07 +0000 (09:16 +0100)
committerJan Olszak <j.olszak@samsung.com>
Wed, 12 Dec 2012 09:41:42 +0000 (10:41 +0100)
[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

index 29fae2b..3dd905c 100644 (file)
@@ -30,6 +30,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <string.h>
 
 namespace DPL
 {
@@ -102,8 +103,9 @@ void UnixSocket::Bind(const Address &address)
     GenericSocket<UnixSocket>::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