build: fix build issue with latest gcc

Fix build issues with gcc 9.1 version

Tracked-On: #3121
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
Yin Fengwei
2019-05-15 02:46:33 +00:00
committed by wenlingz
parent 57ac00a61f
commit 634e310f9b
13 changed files with 20 additions and 13 deletions

View File

@@ -355,7 +355,7 @@ static int create_hugetlb_dirs(int level)
}
memset(tmp_path, '\0', MAX_PATH_LEN);
strncpy(tmp_path, path, MAX_PATH_LEN);
strncpy(tmp_path, path, MAX_PATH_LEN - 1);
if ((tmp_path[len - 1] != '/') && (len < MAX_PATH_LEN - 1))
tmp_path[len] = '/';

View File

@@ -279,7 +279,8 @@ int set_wakeup_timer(time_t t)
req.data.rtc_timer.t = t;
strncpy(req.data.rtc_timer.vmname, vmname,
sizeof(req.data.rtc_timer.vmname));
sizeof(req.data.rtc_timer.vmname) - 1);
req.data.rtc_timer.vmname[sizeof(req.data.rtc_timer.vmname) - 1] = 0;
memset(&ack, 0, sizeof(struct mngr_msg));
ret = mngr_send_msg(acrnd_fd, &req, &ack, 2);