openwrt/tools/gnulib/patches/200-force-disable-after-configure.patch
Michael Pratt d19f8bc199 tools/gnulib: update to branch stable-202501
Move to the June 2025 update of the first 2025 stable branch
in order to better support updating gettext to the latest versions.

More instances of blocking the defining of functions
that use reallocarray() is needed for portability with macOS
as more similar functions have been added.
And one instance is removed as the function was removed.
Refer to a previous commit to explain the need for this.

Manually adjusted patch:
 - 150-portable-tdestroy.patch
 - 160-flag-reallocarray.patch
 - 200-force-disable-after-configure.patch

Removed upstreamed patch:
 - 500-acl-function-name.patch

All other patches are automatically refreshed.

Ref: 5ade7ee60 ("tools/gnulib: add macros to skip reallocarray() functions")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-07-26 14:38:09 +02:00

58 lines
1.7 KiB
Diff

--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -198,6 +198,8 @@ static int klibc_fcntl (int fd, int acti
FD_CLOEXEC is portable, but other flags may be present); otherwise
return -1 and set errno. */
+#if (GNULIB_defined_fcntl || GNULIB_defined_rpl_fcntl)
+
int
fcntl (int fd, int action, /* arg */...)
#undef fcntl
@@ -443,6 +445,8 @@ fcntl (int fd, int action, /* arg */...)
return result;
}
+#endif /* (GNULIB_defined_fcntl || GNULIB_defined_rpl_fcntl) */
+
static int
rpl_fcntl_DUPFD (int fd, int target)
{
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1549,11 +1549,17 @@ _GL_FUNCDECL_RPL (reallocarray, void *,
_GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (reallocarray, void *,
(void *ptr, size_t nmemb, size_t size));
+# if !GNULIB_defined_rpl_reallocarray
+# define GNULIB_defined_rpl_reallocarray 1
+# endif
# else
# if ! @HAVE_REALLOCARRAY@
_GL_FUNCDECL_SYS (reallocarray, void *,
(void *ptr, size_t nmemb, size_t size),
_GL_ATTRIBUTE_NODISCARD);
+# if !GNULIB_defined_reallocarray
+# define GNULIB_defined_reallocarray 1
+# endif
# endif
_GL_CXXALIAS_SYS (reallocarray, void *,
(void *ptr, size_t nmemb, size_t size));
--- a/lib/reallocarray.c
+++ b/lib/reallocarray.c
@@ -23,6 +23,8 @@
#include <stdlib.h>
#include <errno.h>
+#if (GNULIB_defined_reallocarray || GNULIB_defined_rpl_reallocarray)
+
void *
reallocarray (void *ptr, size_t nmemb, size_t size)
{
@@ -36,3 +38,5 @@ reallocarray (void *ptr, size_t nmemb, s
/* Call realloc, setting errno to ENOMEM on failure. */
return realloc (ptr, nbytes);
}
+
+#endif /* (GNULIB_defined_reallocarray || GNULIB_defined_rpl_reallocarray) */