Use recently introduced ClientRequest class in security_manager_shm_open 68/93668/2
authorRafal Krypa <r.krypa@samsung.com>
Tue, 25 Oct 2016 08:13:07 +0000 (10:13 +0200)
committerRafal Krypa <r.krypa@samsung.com>
Tue, 29 Nov 2016 17:18:22 +0000 (09:18 -0800)
Use helper class for client communication with service instead of manual
Serialize/sendToServer/Deserialize.

Change-Id: Ia18a9caa03e0f1626487c1048ba5b629fd8109b7
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
src/client/client-security-manager.cpp

index 82c2407f820cc495500ff6d802857a6804c2c1f0..c986af0b492424d8b225ad03923e510765b60b72 100644 (file)
@@ -1533,21 +1533,9 @@ int security_manager_shm_open(const char *name, int oflag, mode_t mode, const ch
             return -1;
 
         auto scopeClose = makeUnique(&fd, [](int *ptr) -> void { if (*ptr >= 0) close(*ptr); });
+        ClientRequest request(SecurityModuleCall::SHM_APP_NAME);
+        int retval = request.send(std::string(name), std::string(app_name)).getStatus();
 
-        MessageBuffer send, recv;
-        Serialization::Serialize(send,
-                                 (int)SecurityModuleCall::SHM_APP_NAME,
-                                 std::string(name),
-                                 std::string(app_name));
-
-        int retval = sendToServer(SERVICE_SOCKET, send.Pop(), recv);
-        if (retval != SECURITY_MANAGER_SUCCESS) {
-            // Let's propagate errno
-            LogError("Error in sendToServer. Error code: " << retval);
-            return -1;
-        }
-
-        Deserialization::Deserialize(recv, retval);
         switch(retval) {
         case SECURITY_MANAGER_SUCCESS:
             scopeClose.release();
@@ -1577,4 +1565,3 @@ int security_manager_shm_open(const char *name, int oflag, mode_t mode, const ch
         return -1;
     });
 }
-