1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-06 14:02:47 -05:00

Suppress strncpy truncation warnings with GCC 8 and later.

These warnings are bogus as the code is correct so we suppress them in
the places they occur.
This commit is contained in:
Jonathan Liu
2018-09-26 23:20:25 +10:00
committed by Simon Tatham
parent 822d2fd4c3
commit b5c840431a
2 changed files with 14 additions and 0 deletions

View File

@ -1678,7 +1678,14 @@ Socket new_unix_listener(SockAddr listenaddr, Plug plug)
memset(&u, '\0', sizeof(u));
u.su.sun_family = AF_UNIX;
#if __GNUC__ >= 8
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wstringop-truncation"
#endif // __GNUC__ >= 8
strncpy(u.su.sun_path, listenaddr->hostname, sizeof(u.su.sun_path)-1);
#if __GNUC__ >= 8
# pragma GCC diagnostic pop
#endif // __GNUC__ >= 8
addr = &u;
addrlen = sizeof(u.su);