From 2c1c626ca971741ffca2ed22d77545f6befe0632 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sun, 1 Apr 2018 22:48:19 +0200 Subject: fix compiler warning/error with GCC 8.x GCC 8.x reports: worker.c:66:2: error: 'strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation] Replace strncpy() with memcpy(), fixes #25. --- bin/worker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/worker.c b/bin/worker.c index 1f85978..ec54a22 100644 --- a/bin/worker.c +++ b/bin/worker.c @@ -63,7 +63,7 @@ static int send_on_socket(int fd, const char *socket_name, const void *packet, s .un.sun_family = AF_UNIX, }; - strncpy(sa.un.sun_path, socket_name, sizeof(sa.un.sun_path)); + memcpy(sa.un.sun_path, socket_name, sizeof(sa.un.sun_path)); if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(socket_name)) < 0) { perror("sendto() failed"); -- cgit v1.2.3-54-g00ecf