fixed 194d191 from https://gitee.com/liveery/startup_init/pulls/2544
fix:modify create socket restoreContent file
Feature or Bugfix:Bugfix
Binary Source: No

Signed-off-by: liveery <liangming712@huawei.com>
This commit is contained in:
liveery 2024-02-07 13:42:00 +00:00
parent 2dd024a40b
commit 532d363877

View File

@ -30,6 +30,7 @@
#define SOCKET_BUFF_SIZE (256 * 1024)
#define HOS_SOCKET_DIR "/dev/unix/socket"
#define HOS_SOCKET_PATH 64
#define HOS_SOCKET_ENV_PREFIX "OHOS_SOCKET_"
#define MAX_SOCKET_ENV_PREFIX_LEN 64
#define MAX_SOCKET_FD_LEN 16
@ -141,7 +142,13 @@ static int CreateSocket(ServiceSocket *sockopt)
}
INIT_LOGI("CreateSocket %s success", sockopt->name);
PluginExecCmdByName("restoreContentRecurse", HOS_SOCKET_DIR);
char path[HOS_SOCKET_PATH] = { 0 };
if (snprintf_s(path, sizeof(path), sizeof(path) - 1, HOS_SOCKET_DIR"/%s", sockopt->name) < 0) {
close(sockopt->sockFd);
return -1;
}
PluginExecCmdByName("restoreContentRecurse", path);
INIT_LOGI("CreateSocket restoreContentRecurse %s success", path);
return sockopt->sockFd;
}