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 <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yan, Like 2018-09-20 09:29:30 +08:00 committed by lijinxia
parent c51e213905
commit 74c4d71922
1 changed files with 3 additions and 3 deletions

View File

@ -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;