snabbco / snabb

Snabb: Simple and fast packet networking
Apache License 2.0
2.97k stars 301 forks source link

gcc 8.3.1 has a compile error due to the warning -Wstringop-truncation #1425

Open jhe33 opened 5 years ago

jhe33 commented 5 years ago

in file apps/vhost/vhost_user.c, line 36 and 57, the following is the code:

strncpy(un.sun_path, path, sizeof(un.sun_path));

could someone change the strncpy to memcpy to avoid the compile error or add some gcc pragmas, like:

pragma GCC diagnostic push

pragma GCC diagnostic ignored "-Wstringop-truncation"

strncpy(d, s, 32);

pragma GCC diagnostic pop

lukego commented 5 years ago

Thanks for reporting! Could you make this a pull request with a fix please, since you know the solution, and we can merge it?