diff --git a/services/src/init_cmds.c b/services/src/init_cmds.c index 5cfd88bf2b751c2659558df512a8c5ccbf19ddc2..a3c962c2a9d198e783f0d8cbbddeb3ba6239c8e7 100644 --- a/services/src/init_cmds.c +++ b/services/src/init_cmds.c @@ -95,6 +95,7 @@ int GetParamValue(const char *symValue, char *paramValue, unsigned int paramLen) return -1; } INIT_CHECK_RETURN_VALUE(strncpy_s(tmpName, MAX_PARAM_NAME_LEN, p, tmpLen) == EOK, -1); + tmpLen = MAX_PARAM_VALUE_LEN; int ret = SystemReadParam(tmpName, tmpValue, &tmpLen); // get param if (ret != 0) { INIT_LOGE("Failed to read parameter \" %s \"", tmpName); diff --git a/services/src/init_service_socket.c b/services/src/init_service_socket.c index 653f3f8242a240c21caaaaf374b8e078a909cdbd..bc67176ce05834daf0ad7b56efc9585051f4b4d4 100644 --- a/services/src/init_service_socket.c +++ b/services/src/init_service_socket.c @@ -50,7 +50,7 @@ static int CreateSocket(struct ServiceSocket *sockopt) sockopt->name) < 0) { return -1; } - if (access(addr.sun_path, F_OK)) { + if (access(addr.sun_path, F_OK) == 0) { INIT_LOGE("%s already exist, remove it", addr.sun_path); if (unlink(addr.sun_path) != 0) { INIT_LOGE("ulink fail err %d ", errno); diff --git a/ueventd/ueventd.c b/ueventd/ueventd.c index c086608ba18d38ef1bdf98adb6a4d0a8cd1dbbeb..26e2ccecf0cd4d12decc489b7780506a5dcdb3ef 100755 --- a/ueventd/ueventd.c +++ b/ueventd/ueventd.c @@ -119,7 +119,7 @@ static void HandleUevent(const struct Uevent *uevent) static void AddUevent(struct Uevent *uevent, const char *event, size_t len) { - if (uevent == NULL || uevent == NULL || len == 0) { + if (uevent == NULL || event == NULL || len == 0) { return; } diff --git a/ueventd/ueventd_read_cfg.c b/ueventd/ueventd_read_cfg.c index 2036696ffe53d049b0dad54c0cac10d111ed06e3..5678545c6e1c9c2288396ae9a7f45d68c72ae258 100755 --- a/ueventd/ueventd_read_cfg.c +++ b/ueventd/ueventd_read_cfg.c @@ -207,6 +207,7 @@ static int ParseSysfsConfig(char *p) config->uid = (uid_t)StringToInt(items[SYS_CONFIG_UID_NUM], 0); config->gid = (gid_t)StringToInt(items[SYS_CONFIG_GID_NUM], 0); ListAddTail(&g_sysDevices, &config->list); + FreeConfigItems(items, count); return 0; } @@ -216,11 +217,6 @@ static int ParseFirmwareConfig(char *p) if (INVALIDSTRING(p)) { INIT_LOGE("Invalid argument"); } - struct FirmwareUdevConf *config = calloc(1, sizeof(struct FirmwareUdevConf)); - if (config == NULL) { - errno = ENOMEM; - return -1; - } // Sanity checks struct stat st = {}; @@ -234,6 +230,12 @@ static int ParseFirmwareConfig(char *p) return -1; } + struct FirmwareUdevConf *config = calloc(1, sizeof(struct FirmwareUdevConf)); + if (config == NULL) { + errno = ENOMEM; + return -1; + } + config->fmPath = strdup(p); ListAddTail(&g_firmwares, &config->list); return 0;