tools: acrn-manager: fix warnings before updating Makefile
- Print warning if string truncated to avoid the warning generated by -Wformat-truncation by GCC 7.0 and newer version; - fixed strncpy size. 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:
parent
270a833283
commit
227a8c436b
|
@ -479,8 +479,11 @@ static int connect_to_server(const char *name)
|
|||
}
|
||||
|
||||
mfd->addr.sun_family = AF_UNIX;
|
||||
snprintf(mfd->addr.sun_path, sizeof(mfd->addr.sun_path),
|
||||
ret = snprintf(mfd->addr.sun_path, sizeof(mfd->addr.sun_path),
|
||||
"/run/acrn/mngr/%s", s_name);
|
||||
if ((ret >= 0) && (ret < strlen(s_name)))
|
||||
printf("WARN: %s is truncated\n", s_name);
|
||||
|
||||
closedir(dir);
|
||||
ret =
|
||||
connect(mfd->fd, (struct sockaddr *)&mfd->addr, sizeof(mfd->addr));
|
||||
|
|
|
@ -175,7 +175,7 @@ static int load_timer_list(void)
|
|||
}
|
||||
|
||||
memset(arg.name, 0, sizeof(arg.name));
|
||||
strncpy(arg.name, s1, sizeof(s1));
|
||||
strncpy(arg.name, s1, sizeof(arg.name));
|
||||
|
||||
expire = strtoul(s2, NULL, 10);
|
||||
if (expire == 0 || errno == ERANGE) {
|
||||
|
|
Loading…
Reference in New Issue