Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
g++-8.2.0 complains about strncpy with the following warning: ``` drivers/vport.cc: In member function ‘CommandResponse VPort::Init(const bess::pb::VPortArg&)’: drivers/vport.cc:508:12: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound 16 equals destination size [-Werror=stringop-truncation] strncpy(ifname_, name().c_str(), IFNAMSIZ); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/vport.cc:506:12: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound 16 equals destination size [-Werror=stringop-truncation] strncpy(ifname_, arg.ifname().c_str(), IFNAMSIZ); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors Error: drivers/vport.o ``` This was not a problem for arg.ifname(), but could have been a problem for name(). Fix it by: * Checking the length of name() as well (suggested by Chris Torek <chris.torek@gmail.com>) * Put the terminating byte in any case
- Loading branch information