[CRIU] [V3 2/4] Android NDK: UNIX_PATH_MAX is defined in un.h

ning.a.zhang at intel.com ning.a.zhang at intel.com
Thu Apr 4 05:22:30 MSK 2019


From: Zhang Ning <ning.a.zhang at intel.com>

in Android NDK, UNIX_PATH_MAX is already defined,
add ifndef to check.

linux/un.h:
22: #define UNIX_PATH_MAX 108

Cc: Chen Hu <hu1.chen at intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang at intel.com>
---
 compel/src/lib/infect.c | 2 ++
 criu/include/util-pie.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index abf3a0ab..b7db6cf9 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -33,8 +33,10 @@
 #include "common/scm.h"
 #include "common/scm-code.c"
 
+#ifndef UNIX_PATH_MAX
 #define UNIX_PATH_MAX (sizeof(struct sockaddr_un) - \
 			(size_t)((struct sockaddr_un *) 0)->sun_path)
+#endif
 
 #define PARASITE_STACK_SIZE	(16 << 10)
 
diff --git a/criu/include/util-pie.h b/criu/include/util-pie.h
index 31975dda..ce78b0d1 100644
--- a/criu/include/util-pie.h
+++ b/criu/include/util-pie.h
@@ -4,8 +4,10 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
+#ifndef UNIX_PATH_MAX
 #define UNIX_PATH_MAX (sizeof(struct sockaddr_un) - \
 			(size_t)((struct sockaddr_un *) 0)->sun_path)
+#endif
 
 #ifndef SO_PEEK_OFF
 #define SO_PEEK_OFF            42
-- 
2.20.1



More information about the CRIU mailing list