From a58c9d74c8f9c4292d367c6e23d15c4cba03dfde Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.turney@dronecode.org.uk>
Date: Fri, 2 Jan 2015 16:18:52 +0000
Subject: [PATCH 3/4] Fix !HAVE_STRLCPY case
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix error in the !HAVE_STRLCPY case, introduced in commit
f990dd936b5fd1a40290bb88cde517a0ac38f823

It seems that "path[sizeof(path) - 1]" rather than "buf[sizeof(path) - 1]" must
be meant here, especially as the second instance doesn't even compile...

parsedpy.c: In function ‘parse_displayname’:
parsedpy.c:176:9: error: ‘buf’ undeclared (first use in this function)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
 gethost.c  | 2 +-
 parsedpy.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gethost.c b/gethost.c
index c75ae02..e0dc8cb 100644
--- a/gethost.c
+++ b/gethost.c
@@ -200,7 +200,7 @@ struct addrlist *get_address_info (
 	    strlcpy(path, fulldpyname, sizeof(path));
 #else
 	    strncpy(path, fulldpyname, sizeof(path));
-	    buf[sizeof(path) - 1] = '\0';
+	    path[sizeof(path) - 1] = '\0';
 #endif
 	    if (0 == stat(path, &sbuf)) {
 		is_path_to_socket = 1;
diff --git a/parsedpy.c b/parsedpy.c
index 7365224..c638b26 100644
--- a/parsedpy.c
+++ b/parsedpy.c
@@ -173,7 +173,7 @@ parse_displayname (const char *displayname,
         strlcpy(path, displayname, sizeof(path));
 #else
         strncpy(path, displayname, sizeof(path));
-        buf[sizeof(path) - 1] = '\0';
+        path[sizeof(path) - 1] = '\0';
 #endif
         if (0 == stat(path, &sbuf)) {
             family = FamilyLocal;
-- 
2.3.0

