]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
lock.h: Add include for string.h when DEBUG_THREADS is defined.
authorGeorge Joseph <gjoseph@sangoma.com>
Fri, 2 May 2025 18:19:25 +0000 (12:19 -0600)
committerGeorge Joseph <gjoseph@sangoma.com>
Thu, 26 Jun 2025 18:15:04 +0000 (12:15 -0600)
When DEBUG_THREADS is defined, lock.h uses strerror(), which is defined
in the libc string.h file, to print warning messages. If the including
source file doesn't include string.h then strerror() won't be found and
and compile errors will be thrown. Since lock.h depends on this, string.h
is now included from there if DEBUG_THREADS is defined.  This way, including
source files don't have to worry about it.

(cherry picked from commit 54682a538ac88eb23e337730e897dad8a3f467ea)

include/asterisk/lock.h

index d959c1a11ef431e46d8e3e1767916c7bc13ccbaa..dcb8c20ff14cdbd73cc2ce09cac398e29090defe 100644 (file)
@@ -54,6 +54,9 @@
 #ifdef HAVE_BKTR
 #include <execinfo.h>
 #endif
+#ifdef DEBUG_THREADS
+#include <string.h>
+#endif
 
 #ifndef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
 #include "asterisk/time.h"