Check amd socket existence before sending a request 24/318224/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 25 Sep 2024 23:29:31 +0000 (08:29 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 25 Sep 2024 23:29:31 +0000 (08:29 +0900)
Before sending the request to amd, launchpad checks whether the socket
exists or not. If it does not exist, launchpad does not connect to amd.

Change-Id: I1912d5f477843d73fc68e4d0d458dbd8d6f51528
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/launchpad-core/util.cc

index 379dfac8f7115928563138138b6df4c701abc0e9..71fd33e6bfa0fe95db1056e89a51186cfeb68f73 100644 (file)
@@ -632,6 +632,8 @@ int Util::SendCmdToAmd(enum AmdCmd cmd) {
 int Util::SendCmdToAmd(enum AmdCmd cmd, bundle* request, int opt) {
   try {
     std::string endpoint = "/run/aul/daemons/.amd-sock";
+    if (access(endpoint.c_str(), F_OK) != 0) return -1;
+
     ClientSocket socket;
     socket.Connect(endpoint);
     socket.SetReceiveBufferSize(Socket::kSocketMaxBufferSize);