diff options
| author | Sam James <sam@gentoo.org> | 2023-08-30 02:32:13 +0100 | 
|---|---|---|
| committer | Mike Frysinger <vapier@gmail.com> | 2023-08-29 23:31:18 -0400 | 
| commit | c1cd3c9830ce2c68dcf65342688e11a220723619 (patch) | |
| tree | 8ca1dfc6189c06851d3eb45763ca1be876e643fb /src | |
| parent | 86efc43d0e0d7569f5d2e7a58b8c461ac9f7dae8 (diff) | |
| download | openrc-c1cd3c9830ce2c68dcf65342688e11a220723619.tar.xz | |
Don't re-define strlcpy/strlcat with >=glibc-2.38
`>=glibc-2.38` implements strlcpy, strlcat, etc so check for those functions
with Meson and don't provide conflicting prototypes.
Technically, it doesn't need _GNU_SOURCE, but it's easier because it's not
clear right now what glibc wants to guard it with. Note that these are in
POSIX next anyway.
Fixes: https://github.com/OpenRC/openrc/issues/643
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/libeinfo/libeinfo.c | 5 | ||||
| -rw-r--r-- | src/shared/helpers.h | 4 | 
2 files changed, 2 insertions, 7 deletions
| diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c index fb8b6e3d..840233bd 100644 --- a/src/libeinfo/libeinfo.c +++ b/src/libeinfo/libeinfo.c @@ -146,9 +146,7 @@ static const char *const color_terms[] = {  };  #endif -/* strlcat and strlcpy are nice, shame glibc does not define them */ -#ifdef __GLIBC__ -#  if !defined (__UCLIBC__) && !defined (__dietlibc__) +#ifndef HAVE_STRLCPY  static size_t  strlcat(char *dst, const char *src, size_t size)  { @@ -176,7 +174,6 @@ strlcat(char *dst, const char *src, size_t size)  	return dst_n + (s - src);  } -#  endif  #endif  static bool diff --git a/src/shared/helpers.h b/src/shared/helpers.h index 9cf263be..dee41b75 100644 --- a/src/shared/helpers.h +++ b/src/shared/helpers.h @@ -37,10 +37,8 @@  #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) -#ifdef __GLIBC__ -#  if !defined (__UCLIBC__) && !defined (__dietlibc__) +#ifndef HAVE_STRLCPY  #    define strlcpy(dst, src, size) snprintf(dst, size, "%s", src) -#  endif  #endif  #ifndef timespecsub | 
