Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame^] | 1 | From db3a3714be07c8ab51b9ae7b035e4afe9f39c645 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 7 Sep 2022 13:20:22 -0700 |
| 4 | Subject: [PATCH] memory.h: Always define strlcpy for glibc based systems |
| 5 | |
| 6 | android-config.h file includes on compiler cmdline sets HAVE_STRLCPY |
| 7 | unconditionally, since bionic supports it, its no big deal on android |
| 8 | and also no problem when using musl since implementation exists for musl |
| 9 | too, but glibc does not provide this. So either we include libbsd or use |
| 10 | the implementation provided by android-tools here. We are currently |
| 11 | using the in tree implementation for systems which do not provide it |
| 12 | |
| 13 | Upstream-Status: Pending |
| 14 | |
| 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 16 | --- |
| 17 | include/cutils/memory.h | 2 +- |
| 18 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 19 | |
| 20 | diff --git a/include/cutils/memory.h b/include/cutils/memory.h |
| 21 | index e725cdd032..9e99353c58 100644 |
| 22 | --- a/include/cutils/memory.h |
| 23 | +++ b/include/cutils/memory.h |
| 24 | @@ -30,7 +30,7 @@ void android_memset16(uint16_t* dst, uint16_t value, size_t size); |
| 25 | /* size is given in bytes and must be multiple of 4 */ |
| 26 | void android_memset32(uint32_t* dst, uint32_t value, size_t size); |
| 27 | |
| 28 | -#if !HAVE_STRLCPY |
| 29 | +#if !HAVE_STRLCPY || defined(__GLIBC__) |
| 30 | /* Declaration of strlcpy() for platforms that don't already have it. */ |
| 31 | size_t strlcpy(char *dst, const char *src, size_t size); |
| 32 | #endif |
| 33 | -- |
| 34 | 2.37.3 |
| 35 | |