diff --git a/services/init/init_common_service.c b/services/init/init_common_service.c index 816a811e69b91b210f2c7ce340341cab7134c02b..6ae930751149fc8559d7b1af379e1e47fea4dd31 100755 --- a/services/init/init_common_service.c +++ b/services/init/init_common_service.c @@ -22,6 +22,7 @@ #include #endif #include +#include #include #include #include @@ -72,8 +73,8 @@ static int SetPerms(const Service *service) "SetPerms, setgid for %s failed. %d", service->name, errno); } if (service->servPerm.gIDCnt > 1) { - INIT_ERROR_CHECK(setgroups(service->servPerm.gIDCnt - 1, &service->servPerm.gIDArray[1]) == 0, - return SERVICE_FAILURE, + INIT_ERROR_CHECK(setgroups(service->servPerm.gIDCnt - 1, (const gid_t *)&service->servPerm.gIDArray[1]) == 0, + return SERVICE_FAILURE, "SetPerms, setgroups failed. errno = %d, gIDCnt=%d", errno, service->servPerm.gIDCnt); } if (service->servPerm.uID != 0) { diff --git a/services/init/init_service_socket.c b/services/init/init_service_socket.c index 3c4d970b580051504b5e3f1bf82074d963a70758..918ba60a9bc107e49db993d41d3a5daadc646478 100755 --- a/services/init/init_service_socket.c +++ b/services/init/init_service_socket.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -34,7 +35,7 @@ static int GetSocketAddr(struct sockaddr_un *addr, const char *name) { - bzero(addr, sizeof(struct sockaddr_un)); + (void)memset_s(addr, sizeof(struct sockaddr_un), 0x0, sizeof(struct sockaddr_un)); addr->sun_family = AF_UNIX; size_t addrLen = sizeof(addr->sun_path); int ret = snprintf_s(addr->sun_path, addrLen, addrLen - 1, HOS_SOCKET_DIR "/%s", name); diff --git a/services/utils/init_utils.c b/services/utils/init_utils.c index e20578089d5e386d8460325ae64f2969287e5d6a..786a7428cdd6ff1582b9850fa7c97187de2237fe 100755 --- a/services/utils/init_utils.c +++ b/services/utils/init_utils.c @@ -265,7 +265,7 @@ void WaitForFile(const char *source, unsigned int maxCount) unsigned int maxCountTmp = maxCount; INIT_ERROR_CHECK(maxCountTmp <= WAIT_MAX_COUNT, maxCountTmp = WAIT_MAX_COUNT, "WaitForFile max time is 5s"); struct stat sourceInfo = {}; - const unsigned int waitTime = 500000; + unsigned int waitTime = 500000; unsigned int count = 0; do { usleep(waitTime); diff --git a/test/unittest/common/cmd_func_test.cpp b/test/unittest/common/cmd_func_test.cpp index f9c914401001c8ce6bfa2c79452129455bcd4ba5..13b22e7f341edadf5ad804690e3247ab6dc43b18 100755 --- a/test/unittest/common/cmd_func_test.cpp +++ b/test/unittest/common/cmd_func_test.cpp @@ -37,9 +37,11 @@ const std::string TEST_DRI = ROOT_DIR + "StartInitTestDir"; const std::string TEST_FILE = TEST_DRI + "/test.txt"; const std::string TEST_CFG_ILLEGAL = TEST_DRI + "/illegal.cfg"; const std::string TEST_PROC_MOUNTS = "/proc/mounts"; +#ifndef USE_EMMC_STORAGE const uid_t TEST_FILE_UID = 999; const gid_t TEST_FILE_GID = 999; const mode_t TEST_FILE_MODE = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; +#endif // init.cfg releated const std::string CFG_FILE = "/etc/init.cfg"; diff --git a/watchdog/init_watchdog.c b/watchdog/init_watchdog.c index 029f7d667bad002bba23edcf56017f2e1a2616b8..50ff662ad22065ee82939a7d1724850c67a7c550 100755 --- a/watchdog/init_watchdog.c +++ b/watchdog/init_watchdog.c @@ -41,7 +41,7 @@ static void WaitAtStartup(const char *source) { unsigned int count = 0; struct stat sourceInfo; - const unsigned int waitTime = 500000; + unsigned int waitTime = 500000; do { usleep(waitTime); count++;