silly web server: silent a compilation warning

Recent gcc warns when byte count of strncpy() equals the destination
buffer size. Since the destination buffer is previously cleared and
the source string is always shorter, reducing the byte count by one
silents the warning without affecting the result.

Closes #5059
This commit is contained in:
Patrick Monnerat 2020-01-28 11:56:41 +01:00 committed by Daniel Stenberg
parent 06a1b82140
commit 77336671dc
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 1 additions and 1 deletions

View File

@ -2163,7 +2163,7 @@ int main(int argc, char *argv[])
case AF_UNIX:
memset(&me.sau, 0, sizeof(me.sau));
me.sau.sun_family = AF_UNIX;
strncpy(me.sau.sun_path, unix_socket, sizeof(me.sau.sun_path));
strncpy(me.sau.sun_path, unix_socket, sizeof(me.sau.sun_path) - 1);
rc = bind(sock, &me.sa, sizeof(me.sau));
if(0 != rc && errno == EADDRINUSE) {
struct stat statbuf;