diff --git a/interfaces/innerkits/control_fd/control_fd.h b/interfaces/innerkits/control_fd/control_fd.h index e0dbe2ecc7d4fad49d5096ea357b49b6ea841b8e..d91f55f5a29483b11abda8868df45fa079ff1707 100644 --- a/interfaces/innerkits/control_fd/control_fd.h +++ b/interfaces/innerkits/control_fd/control_fd.h @@ -17,6 +17,7 @@ #define CONTROL_FD_ #include +#include #include "loop_event.h" #ifdef __cplusplus @@ -53,7 +54,7 @@ typedef enum { typedef struct { uint16_t msgSize; uint16_t type; - uint32_t pid; + pid_t pid; char fifoName[FIFO_PATH_SIZE]; char cmd[0]; } CmdMessage; diff --git a/interfaces/innerkits/control_fd/control_fd_client.c b/interfaces/innerkits/control_fd/control_fd_client.c index a8ec22969a53143f04e36e586b19ce9c228342f6..160cf5baed894cd2e6c4e6147ca35edf5454ff5c 100644 --- a/interfaces/innerkits/control_fd/control_fd_client.c +++ b/interfaces/innerkits/control_fd/control_fd_client.c @@ -118,17 +118,26 @@ static void CmdDisConnectComplete(const TaskHandle client) static void CmdAgentInit(WatcherHandle handle, const char *path, bool read, ProcessWatchEvent func) { + if (path == NULL) { + BEGET_LOGE("[control_fd] Invaild parameter"); + return; + } BEGET_LOGI("[control_fd] client open %s", (read ? "read" : "write")); + char *realPath = GetRealPath(path); + if (realPath == NULL) { + BEGET_LOGE("[control_fd] Failed get real path %s", path); + return; + } if (read == true) { - g_FifoReadFd = open(path, O_RDONLY | O_TRUNC | O_NONBLOCK); - BEGET_ERROR_CHECK(g_FifoReadFd >= 0, return, "[control_fd] Failed to open fifo read"); + g_FifoReadFd = open(realPath, O_RDONLY | O_TRUNC | O_NONBLOCK); + BEGET_ERROR_CHECK(g_FifoReadFd >= 0, free(realPath); return, "[control_fd] Failed to open fifo read"); BEGET_LOGI("[control_fd] g_FifoReadFd is %d", g_FifoReadFd); } else { - g_FifoWriteFd = open(path, O_WRONLY | O_TRUNC); - BEGET_ERROR_CHECK(g_FifoWriteFd >= 0, return, "[control_fd] Failed to open fifo write"); + g_FifoWriteFd = open(realPath, O_WRONLY | O_TRUNC); + BEGET_ERROR_CHECK(g_FifoWriteFd >= 0, free(realPath); return, "[control_fd] Failed to open fifo write"); BEGET_LOGI("[control_fd] g_FifoWriteFd is %d", g_FifoWriteFd); } - + free(realPath); // start watcher for stdin LE_WatchInfo info = {}; info.flags = 0; diff --git a/interfaces/innerkits/control_fd/control_fd_service.c b/interfaces/innerkits/control_fd/control_fd_service.c index c3892849a1aadba4b2bf30380dc25c4f5acd8d14..9fe678d8fd0425ac874df6cf9dbda09f85ae58dc 100644 --- a/interfaces/innerkits/control_fd/control_fd_service.c +++ b/interfaces/innerkits/control_fd/control_fd_service.c @@ -16,7 +16,6 @@ #include #include #include -#include #include "beget_ext.h" #include "control_fd.h" diff --git a/interfaces/innerkits/sandbox/BUILD.gn b/interfaces/innerkits/sandbox/BUILD.gn index e549f468137b34f38e8560bf2a7cfc4402a00d6b..3dda7176da9fb5a2f70921a1e3b526a125ea4c58 100644 --- a/interfaces/innerkits/sandbox/BUILD.gn +++ b/interfaces/innerkits/sandbox/BUILD.gn @@ -63,5 +63,8 @@ ohos_static_library("libsandbox_static") { "//base/startup/init_lite/services/utils:libinit_utils", "//third_party/cJSON:cjson_static", ] + if (target_cpu == "arm64") { + defines = [ "SUPPORT_64BIT" ] + } part_name = "init" }