erofs-utils: lib: Explicitly include <pthread.h> where used
authorSatoshi Niwa <niwa@google.com>
Tue, 8 Oct 2024 06:08:19 +0000 (15:08 +0900)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Wed, 9 Oct 2024 03:40:40 +0000 (11:40 +0800)
compress.c and inode.c use pthread functions but do not explicitly include <pthread.h>.
This causes build failures with the Android build system,
which throws "error: implicit declaration of function pthread_*".

Signed-off-by: Satoshi Niwa <niwa@google.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241008060819.2442945-1-niwa@google.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
lib/compress.c
lib/inode.c

index 17e7112cde760a08fae6e43828a904f43b417aba..5d6fb2a030e25bc530fb6766587c72ecb1718396 100644 (file)
@@ -8,6 +8,9 @@
 #ifndef _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE
 #endif
+#ifdef EROFS_MT_ENABLED
+#include <pthread.h>
+#endif
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
index 7958d432ee2878293f54d3bc84555213e0eb3831..48f46b17a0037f21389e97905b7930c477f9aa99 100644 (file)
@@ -6,6 +6,9 @@
  * with heavy changes by Gao Xiang <xiang@kernel.org>
  */
 #define _GNU_SOURCE
+#ifdef EROFS_MT_ENABLED
+#include <pthread.h>
+#endif
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>