diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2019-05-27 11:57:30 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-05-28 10:36:09 +0200 |
commit | 766ce4dcbe1fa710e9d292f30df806a5c73c2d7c (patch) | |
tree | 85719c93a767e3e69dd8e78596bb08a55a9cb30d /scripts | |
parent | 5596a398fc85bd66c3aa5afb79b41b2fba016617 (diff) | |
download | barebox-766ce4dcbe1fa710e9d292f30df806a5c73c2d7c.tar.gz barebox-766ce4dcbe1fa710e9d292f30df806a5c73c2d7c.tar.xz |
scripts: includes: restrict strlcpy prototype to glibc
Defining strlcpy here clashes on macOS, which has some compiler magic
around their strlcpy declaration. Fix this by inverting the check
to declare the prototype only if we are on __GLIBC__. As uClibc may
define __GLIBC__ as well, check for absence of its __UCLIBC__.
This is in-line with what Linux has been doing since 0215d59b15
("tools lib: Reinstate strlcpy() header guard with __UCLIBC__").
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/include/linux/string.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/include/linux/string.h b/scripts/include/linux/string.h index e26223f1f2..649287b80a 100644 --- a/scripts/include/linux/string.h +++ b/scripts/include/linux/string.h @@ -8,7 +8,11 @@ void *memdup(const void *src, size_t len); int strtobool(const char *s, bool *res); -#ifndef __UCLIBC__ +/* + * glibc based builds needs the extern while uClibc doesn't. + * However uClibc headers also define __GLIBC__ hence the hack below + */ +#if defined(__GLIBC) && !defined(__UCLIBC__) extern size_t strlcpy(char *dest, const char *src, size_t size); #endif |