From 74c4d71922ef2ae88b6067d2c152ac34664da298 Mon Sep 17 00:00:00 2001 From: "Yan, Like" Date: Thu, 20 Sep 2018 09:29:30 +0800 Subject: [PATCH] tools: acrnlog: fix several compiler warnings This commit fixes several compiler warnings before enabling compiler options to harden software by: - increase name[] size to avoid string truncation; - add parentheses around assignment as compiler suggests. Tracked-On: #1122 Signed-off-by: Yan, Like Acked-by: Eddie Dong --- tools/acrnlog/acrnlog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/acrnlog/acrnlog.c b/tools/acrnlog/acrnlog.c index 5b64d5b7d..7eea4798b 100644 --- a/tools/acrnlog/acrnlog.c +++ b/tools/acrnlog/acrnlog.c @@ -67,7 +67,7 @@ static int get_cpu_num(void) return -1; } - while (pdir = readdir(dir)) { + while ((pdir = readdir(dir)) != NULL) { ret = strstr(pdir->d_name, prefix); if (ret) cpu_num++; @@ -389,7 +389,7 @@ static int mk_dir(const char *path) path, strerror(errno)); return -1; } - while (pdir = readdir(dir)) { + while ((pdir = readdir(dir)) != NULL) { find = strstr(pdir->d_name, prefix); if (!find) continue; @@ -458,7 +458,7 @@ static pthread_t cur_thread; int main(int argc, char *argv[]) { - char name[24]; + char name[32]; int i, ret; int num_cur, num_last; struct hvlog_msg *msg;