From 78941a1ca86363ddcb7bab93f6ecf801aed35a1f Mon Sep 17 00:00:00 2001 From: zhong_ning Date: Wed, 21 Jul 2021 16:48:21 +0800 Subject: [PATCH 1/4] fix code style Signed-off-by: zhong_ning --- services/log/init_log.c | 5 ++--- services/src/init_cmds.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/services/log/init_log.c b/services/log/init_log.c index 678b7f35c..dbadec4bd 100644 --- a/services/log/init_log.c +++ b/services/log/init_log.c @@ -71,9 +71,8 @@ void InitLog(const char *tag, InitLogLevel logLevel, const char *fileName, int l return; } - time_t logTime; - time(&logTime); - struct tm *t = gmtime(&logTime); + time_t second = time(0); + struct tm *t = localtime(&second); if (t == NULL) { printf("time is NULL.\n"); return; diff --git a/services/src/init_cmds.c b/services/src/init_cmds.c index d11e0ec35..b3ffe4788 100644 --- a/services/src/init_cmds.c +++ b/services/src/init_cmds.c @@ -329,10 +329,14 @@ static void DoCopy(const char* cmdContent) out: FreeCmd(&ctx); ctx = NULL; - close(srcFd); - srcFd = -1; - close(dstFd); - dstFd = -1; + if (srcFd >= 0) { + close(srcFd); + srcFd = -1; + } + if (dstFd >= 0) { + close(dstFd); + dstFd = -1; + } return; } -- Gitee From 8025d011b6bbbf6ccf1e8e4ec30ad36d57b320e5 Mon Sep 17 00:00:00 2001 From: zhong_ning Date: Wed, 21 Jul 2021 16:50:05 +0800 Subject: [PATCH 2/4] fix code style Signed-off-by: zhong_ning --- initsync/src/init_sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/initsync/src/init_sync.c b/initsync/src/init_sync.c index e65af4e65..1e517494c 100644 --- a/initsync/src/init_sync.c +++ b/initsync/src/init_sync.c @@ -31,12 +31,12 @@ static int SendCmd(int cmd, unsigned long arg) if (fd != -1) { int ret = ioctl(fd, cmd, arg); if (ret == -1) { - INIT_LOGE("[Init] [ERR] %s!", strerror(errno)); + INIT_LOGE("[Init] [ERR] %d!", errno); } close(fd); return ret; } - INIT_LOGE("[Init] [ERR] %s!", strerror(errno)); + INIT_LOGE("[Init] [ERR] %d!", errno); return fd; } -- Gitee From 232ba0fdceb1eb3b62fca36af82e310af2e49e49 Mon Sep 17 00:00:00 2001 From: zhong_ning Date: Wed, 21 Jul 2021 17:42:53 +0800 Subject: [PATCH 3/4] fix code style Signed-off-by: zhong_ning --- initsync/src/init_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/initsync/src/init_sync.c b/initsync/src/init_sync.c index 1e517494c..e2b0539e6 100644 --- a/initsync/src/init_sync.c +++ b/initsync/src/init_sync.c @@ -45,7 +45,7 @@ int InitListen(unsigned long eventMask, unsigned int wait) QuickstartListenArgs args; args.wait = wait; args.events = eventMask; - return SendCmd(QUICKSTART_LISTEN, (unsigned long)&args); + return SendCmd(QUICKSTART_LISTEN, (uintptr_t)&args); } int NotifyInit(unsigned long event) -- Gitee From df10449b1003131614a8db2a2bfa7bd75cf31676 Mon Sep 17 00:00:00 2001 From: zhong_ning Date: Wed, 21 Jul 2021 18:25:23 +0800 Subject: [PATCH 4/4] fix l1 compile error Signed-off-by: zhong_ning --- initsync/src/init_sync.c | 1 + 1 file changed, 1 insertion(+) diff --git a/initsync/src/init_sync.c b/initsync/src/init_sync.c index e2b0539e6..73ba642b7 100644 --- a/initsync/src/init_sync.c +++ b/initsync/src/init_sync.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include -- Gitee