summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2023-12-15 12:34:17 +0900
committerHwanKyu Jhun <h.jhun@samsung.com>2023-12-15 04:22:25 +0000
commit82ef5e16b3dc0e30588bc73e4caef81fcb7aa5ff (patch)
tree083b2eb562c93f414becd96bfda1495849d88d7c
parent742a523eb9647b051a7e0f6512733840dde8e8b8 (diff)
downloadlaunchpad-82ef5e16b3dc0e30588bc73e4caef81fcb7aa5ff.tar.gz
launchpad-82ef5e16b3dc0e30588bc73e4caef81fcb7aa5ff.tar.bz2
launchpad-82ef5e16b3dc0e30588bc73e4caef81fcb7aa5ff.zip
Use access() instead of std::filesystem::exists
The std::filesystem::exists uses stat() internally. The read permission is needed to use stat(). It can cause the smack issues. This patch changes the implementation to using access() with F_OK option. Change-Id: I367487b010c7abf50015004e86c3bb6ad88aa0e6 Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--src/lib/launchpad-glib/util.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/launchpad-glib/util.cc b/src/lib/launchpad-glib/util.cc
index c330f5d..2e79382 100644
--- a/src/lib/launchpad-glib/util.cc
+++ b/src/lib/launchpad-glib/util.cc
@@ -519,11 +519,11 @@ int Util::PrepareAppSocket() {
try {
std::string path = "/run/aul/apps/" + std::to_string(getuid()) + "/" +
std::to_string(getpid());
- ServerSocket socket;
- if (!fs::exists(path))
+ if (access(path.c_str(), F_OK) != 0)
fs::create_directory(path);
path += "/.app-sock";
+ ServerSocket socket;
socket.Bind(path);
socket.Listen(128);
socket.SetReceiveBufferSize(Socket::kSocketMaxBufferSize);