pci: fix strncpy warnings 40/16840/2
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 16 Jan 2019 18:23:16 +0000 (10:23 -0800)
committerDamjan Marion <dmarion@me.com>
Thu, 17 Jan 2019 09:19:33 +0000 (09:19 +0000)
commit4e8a83183e9a381d6c44fa3b94faf735d536e811
tree4294a6c241a18c6c7aef5724bd686143ee837766
parentef080e1f9bad884b95ef23307b0d856c971dfcc2
pci: fix strncpy warnings

Doing strncpy(ifr.ifr_name, s, sizeof(ifr.ifr_name)) will cause
a warning about string truncation with GCC 8 (and other tools).
Fix this by using sizeof(ifr.ifr_name) - 1. Also, there is no
need to manually zero the end of the string since the whole
ifr structure is already zeroed by memset.

Change-Id: I9440d602ecdd9f8592b69bab2e77479146d00d76
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
src/vlib/linux/pci.c