client: fix gcc8 stringop-truncation warnings
| In function 'open_nbd_socket.isra.2',
| inlined from 'main' at ../git/nbd-proxy.c:835:7:
| ../git/nbd-proxy.c:102:2: error: 'strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
| strncpy(addr.sun_path, path, sizeof(addr.sun_path));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Change-Id: I9f412d789f4e5ef1dffe05b37d903a5375fea8ec
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/nbd-proxy.c b/nbd-proxy.c
index f98feec..35f0ccd 100644
--- a/nbd-proxy.c
+++ b/nbd-proxy.c
@@ -99,7 +99,7 @@
}
addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, path, sizeof(addr.sun_path));
+ strncpy(addr.sun_path, path, sizeof(addr.sun_path) -1);
rc = bind(sd, (struct sockaddr *)&addr, sizeof(addr));
if (rc) {