Using filesystem::exist to check app socket 95/318795/1
authorJihoi Kim <jihoi.kim@samsung.com>
Fri, 24 Jan 2025 06:32:54 +0000 (15:32 +0900)
committerJihoi Kim <jihoi.kim@samsung.com>
Fri, 24 Jan 2025 06:44:42 +0000 (15:44 +0900)
- If a directory in the path has 700 permission, access() will fail.

Change-Id: I31619393ef324f0b3bc923f2332aa7721683d18a
Signed-off-by: Jihoi Kim <jihoi.kim@samsung.com>
src/lib/app_com/app_com_broker.cc

index 3f59c7993ea357ffbabb81a192f55979628f9022..2ebbc3dfa40925cef133e868663947cd1a4c1bc4 100644 (file)
@@ -300,7 +300,10 @@ std::shared_ptr<AppComSocket> AppComBroker::CreateAppComSocket(pid_t pid,
   try {
     auto app_com_socket = std::make_shared<AppComSocket>(pid, uid, this);
     std::string endpoint = GetEndpoint(pid, uid);
-    if (access(endpoint.c_str(), F_OK) != 0) {
+
+    // NOTE: If a directory in endpoint path has 700 permission, access() fail.
+    std::filesystem::path path(endpoint);
+    if (!std::filesystem::exists(path)) {
       _E("pid(%d) app com endpoint does not exists. errno(%d)", pid, errno);
       return nullptr;
     }