Control: tags -1 + patch

On Mon, Apr 04, 2022 at 09:54:13PM +0200, Helmut Grohne wrote:
> The gentoo bug has a few more details and proposed two distinct
> workarounds:
>  a. Drop the _GNU_SOURCE define. Doing so makes musl's sched.h not emit
>     a calloc declaration. I don't know what other consequences this
>     would have.
>  b. Change LBER_LEN_T to size_t. I suppose doing so would break ABI on
>     64bit architectures.

Proposing a third one that practically works and has little risk of
breakage:

 c. Reorder the #define calloc vs #include <pthread.h>

This doesn't fix the root cause, but the symptom. :)

Helmut
--- a/libraries/librewrite/rewrite-int.h
+++ b/libraries/librewrite/rewrite-int.h
@@ -40,6 +40,11 @@

 #include <rewrite.h>

+#ifndef NO_THREADS
+#define USE_REWRITE_LDAP_PVT_THREADS
+#include <ldap_pvt_thread.h>
+#endif
+
 #define malloc(x)	ber_memalloc(x)
 #define calloc(x,y)	ber_memcalloc(x,y)
 #define realloc(x,y)	ber_memrealloc(x,y)
@@ -47,11 +52,6 @@
 #undef strdup
 #define	strdup(x)	ber_strdup(x)

-#ifndef NO_THREADS
-#define USE_REWRITE_LDAP_PVT_THREADS
-#include <ldap_pvt_thread.h>
-#endif
-
 /*
  * For details, see RATIONALE.
  */

Reply via email to