未验证 提交 9c0259f6 编写于 作者: O openharmony_ci 提交者: Gitee

!719 修复静态检查问题

Merge pull request !719 from Mupceet/init527_1
......@@ -17,6 +17,7 @@
#define CONTROL_FD_
#include <stdint.h>
#include <fcntl.h>
#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;
......
......@@ -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;
......
......@@ -16,7 +16,6 @@
#include <stdbool.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/wait.h>
#include "beget_ext.h"
#include "control_fd.h"
......
......@@ -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"
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册