summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2020-01-28 11:56:41 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-03-08 17:30:55 +0100
commit77336671dc4d036bc36c135afba47ea52b1b6663 (patch)
treecf26ead368fef124cb089d38c716f540bd8a3ae5
parent06a1b821404c176fde883a826a0db712695dd964 (diff)
downloadcurl-77336671dc4d036bc36c135afba47ea52b1b6663.tar.gz
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
-rw-r--r--tests/server/sws.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c
index eed2d5fd9..b397ed19b 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -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;