From db3a3714be07c8ab51b9ae7b035e4afe9f39c645 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 7 Sep 2022 13:20:22 -0700
Subject: [PATCH] memory.h: Always define strlcpy for glibc based systems

android-config.h file includes on compiler cmdline sets HAVE_STRLCPY
unconditionally, since bionic supports it, its no big deal on android
and also no problem when using musl since implementation exists for musl
too, but glibc does not provide this. So either we include libbsd or use
the implementation provided by android-tools here. We are currently
using the in tree implementation for systems which do not provide it

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 include/cutils/memory.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/cutils/memory.h b/include/cutils/memory.h
index e725cdd032..9e99353c58 100644
--- a/include/cutils/memory.h
+++ b/include/cutils/memory.h
@@ -30,7 +30,7 @@ void android_memset16(uint16_t* dst, uint16_t value, size_t size);
 /* size is given in bytes and must be multiple of 4 */
 void android_memset32(uint32_t* dst, uint32_t value, size_t size);
 
-#if !HAVE_STRLCPY
+#if !HAVE_STRLCPY || defined(__GLIBC__)
 /* Declaration of strlcpy() for platforms that don't already have it. */
 size_t strlcpy(char *dst, const char *src, size_t size);
 #endif
-- 
2.37.3

