提交 cc611bb9 编写于 作者: C chengjinsong 提交者: cheng_jinsong
上级 f9a21d26
......@@ -24,6 +24,7 @@
#define REBOOT_NAME_PREFIX "reboot,"
#define REBOOT_CMD_PREFIX "reboot."
#define REBOOT_REPLACE_PREFIX "reboot."
#define PARAM_CMD_MAX 100
static int RebootHookWrapper(const HOOK_INFO *hookInfo, void *executionContext)
{
......@@ -111,6 +112,7 @@ static int SetParamCmdInfo(ParamCmdInfo *currInfo, CmdExecutor executor, const c
static int AddRebootCmdExecutor_(const char *cmd, CmdExecutor executor)
{
PLUGIN_CHECK(g_rebootParamCmdMaxNumber <= PARAM_CMD_MAX, return -1, "Param cmd max number exceed limit");
if (g_rebootParamCmdMaxNumber == 0 || g_rebootParamCmdMaxNumber <= g_rebootParamCmdValidNumber) {
g_rebootParamCmdMaxNumber += 5; // inc 5 once time
ParamCmdInfo *cmdInfos = calloc(1, sizeof(ParamCmdInfo) * g_rebootParamCmdMaxNumber);
......@@ -126,6 +128,7 @@ static int AddRebootCmdExecutor_(const char *cmd, CmdExecutor executor)
}
g_rebootParamCmdInfos = cmdInfos;
}
PLUGIN_CHECK(g_rebootParamCmdValidNumber < g_rebootParamCmdMaxNumber, return -1, "Param cmd number exceed limit");
return SetParamCmdInfo(&g_rebootParamCmdInfos[g_rebootParamCmdValidNumber], executor, cmd);
}
......
......@@ -295,6 +295,7 @@ static int32_t BShellParamCmdMemGet(BShellHandle shell, int32_t argc, char *argv
PLUGIN_CHECK(argc > 1, return -1, "Invalid parameter");
uint32_t buffSize = 0; // 1024 max buffer for decode
char *buff = GetLocalBuffer(&buffSize);
PLUGIN_CHECK(buff != NULL, return -1, "Failed to get local buffer");
int ret = sprintf_s(buff, buffSize - 1, "/proc/%s/smaps", argv[1]);
PLUGIN_CHECK(ret > 0, return -1, "Failed to format path %s", argv[1]);
buff[ret] = '\0';
......
......@@ -201,8 +201,8 @@ public:
if (task != nullptr) {
task->handleEvent = TestHandleTaskEvent;
ProcessEvent((EventLoop *)LE_GetDefaultLoop(), testfd, Event_Read);
((HashTab *)(((EventLoop *)LE_GetDefaultLoop())->taskMap))->nodeFree(&task->hashNode);
}
((HashTab *)(((EventLoop *)LE_GetDefaultLoop())->taskMap))->nodeFree(&task->hashNode);
}
void ProcessasynEvent()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册