diff options
author | Christian Hesse <mail@eworm.de> | 2018-04-01 22:48:19 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2018-04-01 22:48:19 +0200 |
commit | 2c1c626ca971741ffca2ed22d77545f6befe0632 (patch) | |
tree | 5bc350f30f99ffe295a0755a38f6c2c689897915 | |
parent | 4a74a1f483533de6a2ebd5c65d888d1be3995ac3 (diff) | |
download | mkinitcpio-ykfde-2c1c626ca971741ffca2ed22d77545f6befe0632.tar.gz mkinitcpio-ykfde-2c1c626ca971741ffca2ed22d77545f6befe0632.tar.zst |
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.
-rw-r--r-- | bin/worker.c | 2 |
1 files changed, 1 insertions, 1 deletions
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"); |