citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 6976598d086146c00bcee34c12a6781a1388335d
parent 9307a9a1a892b0695f932c15acca50f96d15b025
Author: Kyle Milz <kyle@0x30.net>
Date:   Sat,  9 Jul 2016 12:26:10 -0600

lib: use strlcpy again that Linux is not Tier 1

Diffstat:
Mlib/runtime.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/runtime.c b/lib/runtime.c @@ -3,7 +3,7 @@ #include <limits.h> /* PATH_MAX */ #include <pthread.h> /* pthread_create */ #include <stdlib.h> /* getenv */ -#include <string.h> /* strncpy */ +#include <string.h> /* strlcpy */ #include <unistd.h> /* access, get{pid,ppid,pgrp}, read, write */ #include <sys/socket.h> /* socket */ @@ -209,9 +209,7 @@ relay_thread(void *arg) memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; - /* Avoid strlcpy here because Linux needs -lbsd in that case. */ - strncpy(addr.sun_path, viewer_sock, sizeof(addr.sun_path)); - addr.sun_path[sizeof(addr.sun_path) - 1] = '\0'; + strlcpy(addr.sun_path, viewer_sock, sizeof(addr.sun_path)); while (1) { if (connect(fd, (struct sockaddr *)&addr, sizeof(addr))) {