examples/vm_power: fix build on Ubuntu 20.04
authorBruce Richardson <bruce.richardson@intel.com>
Wed, 28 Oct 2020 16:27:00 +0000 (16:27 +0000)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 30 Oct 2020 13:54:23 +0000 (14:54 +0100)
commita9f57cfc08810a0936bdc4f4766373a9802bca8e
treed7f80345d79167ca91665bcba7925faa1d5226ab
parent7157a9dcc4e2eb4e39945c1a91304d8fc70d7c57
examples/vm_power: fix build on Ubuntu 20.04

When compiling on Ubuntu 20.04, a warning was issued about possible
truncation of the path string for the power management socket.

channel_manager.c: In function ‘add_all_channels’:
channel_manager.c:470:41: warning: ‘%s’ directive output may be
  truncated writing up to 255 bytes into a region of size 90
  [-Wformat-truncation=]
  470 |     sizeof(chan_info->channel_path), "%s%s",
      |                                         ^~

This can be fixed by adding in an explicit truncation check to the code
and handling it appropriately.

Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
examples/vm_power_manager/channel_manager.c