libsepol, checkpolicy, secilc: Replace #ifdef DARWIN with __APPLE__.
PATCH 1/1 libsepol, checkpolicy, secilc: Replace #ifdef DARWIN with __APPLE__.
As per discussion in https://android-review.googlesource.com/#/c/221980,
we should be using #ifdef __APPLE__ rather than our own custom-defined DARWIN for building on MacOS X.
--- checkpolicy/Android.mk | 4 ---- checkpolicy/checkpolicy.c | 2 +- checkpolicy/policy_define.c | 2 +- libsepol/Android.mk | 4 ---- libsepol/src/genbools.c | 4 ++-- libsepol/src/genusers.c | 4 ++-- libsepol/src/node_record.c | 4 ++-- libsepol/src/private.h | 4 ++-- secilc/Android.mk | 4 ---- 9 files changed, 10 insertions(+), 22 deletions(-)
checkpolicy/Android.mk +0 -4
@@ -12,10 +12,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS),darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/ \ $(LOCAL_PATH)/../libsepol/include/ \
checkpolicy/checkpolicy.c +1 -1
@@ -73,7 +73,7 @@#include <errno.h> #include <sys/mman.h> -#ifdef DARWIN +#ifdef __APPLE__#include <ctype.h> #endif
checkpolicy/policy_define.c +1 -1
@@ -5140,7 +5140,7 @@ int define_ipv6_node_context(void)memset (newc,0 ,sizeof (ocontext_t)); -#ifdef DARWIN +#ifdef __APPLE__memcpy (&newc->u.node6.addr[0 ], &addr.s6_addr[0 ],16 );memcpy (&newc->u.node6.mask[0 ], &mask.s6_addr[0 ],16 );#else
libsepol/Android.mk +0 -4
@@ -69,10 +69,6 @@ common_cflags := \ -Wshadow -Wmissing-noreturn \ -Wmissing-format-attribute -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/include/ \ $(LOCAL_PATH)/src/ \
libsepol/src/genbools.c +2 -2
@@ -79,7 +79,7 @@ static int load_booleans(struct policydb *policydb, const char *path,if (boolf ==NULL ) goto localbool; -#ifdef DARWIN +#ifdef __APPLE__if ((buffer = (char *)malloc (255 *sizeof (char ))) ==NULL ) {ERR (NULL ,"out of memory" );return -1 ;
@@ -111,7 +111,7 @@ static int load_booleans(struct policydb *policydb, const char *path, boolf =fopen (localbools,"r" );if (boolf !=NULL ) { -#ifdef DARWIN +#ifdef __APPLE__while (fgets (buffer,255 , boolf) !=NULL ) {#else
libsepol/src/genusers.c +2 -2
@@ -7,7 +7,7 @@#include <sepol/policydb/policydb.h> -#ifndef DARWIN +#ifndef __APPLE__#include <stdio_ext.h> #endif
@@ -47,7 +47,7 @@ static int load_users(struct policydb *policydb, const char *path)if (fp ==NULL )return -1 ; -#ifdef DARWIN +#ifdef __APPLE__if ((buffer = (char *)malloc (255 *sizeof (char ))) ==NULL ) {ERR (NULL ,"out of memory" );return -1 ;
libsepol/src/node_record.c +2 -2
@@ -70,7 +70,7 @@ static int node_parse_addr(sepol_handle_t * handle,return STATUS_ERR ; } -#ifdef DARWIN +#ifdef __APPLE__memcpy (addr_bytes, in_addr.s6_addr,16 );#else memcpy (addr_bytes, in_addr.s6_addr32,16 );
@@ -162,7 +162,7 @@ static int node_expand_addr(sepol_handle_t * handle, {struct in6_addr addr;memset (&addr,0 ,sizeof (struct in6_addr )); -#ifdef DARWIN +#ifdef __APPLE__memcpy (&addr.s6_addr[0 ], addr_bytes,16 );#else memcpy (&addr.s6_addr32[0 ], addr_bytes,16 );
libsepol/src/private.h +2 -2
@@ -5,7 +5,7 @@#include <sepol/policydb/policydb.h> -#ifdef DARWIN +#ifdef __APPLE__#include <sys/types.h> #include <machine/endian.h> #else
@@ -16,7 +16,7 @@#include <errno.h> #include <dso.h> -#ifdef DARWIN +#ifdef __APPLE__#define __BYTE_ORDER BYTE_ORDER#define __LITTLE_ENDIAN LITTLE_ENDIAN#endif
secilc/Android.mk +0 -4
@@ -6,10 +6,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/../libsepol/cil/include/ \ $(LOCAL_PATH)/../libsepol/include/ \
Signature · 1 line
2.5.5
lgtm. thanks!
Quoted 179 lines · Stephen Smalley
As per discussion in https://android-review.googlesource.com/#/c/221980,
we should be using #ifdef__APPLE__rather than our own custom-defined DARWIN for building on MacOS X.Signed-off-by Stephen Smalley <[email protected]>--- checkpolicy/Android.mk | 4 ---- checkpolicy/checkpolicy.c | 2 +- checkpolicy/policy_define.c | 2 +- libsepol/Android.mk | 4 ---- libsepol/src/genbools.c | 4 ++-- libsepol/src/genusers.c | 4 ++-- libsepol/src/node_record.c | 4 ++-- libsepol/src/private.h | 4 ++-- secilc/Android.mk | 4 ---- 9 files changed, 10 insertions(+), 22 deletions(-)checkpolicy/Android.mk +0
-4@@ -12,10 +12,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS),darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/ \ $(LOCAL_PATH)/../libsepol/include/ \checkpolicy/checkpolicy.c +1
-1@@ -73,7 +73,7 @@#include <errno.h> #include <sys/mman.h> -#ifdef DARWIN +#ifdef __APPLE__#include <ctype.h> #endif checkpolicy/policy_define.c +1
-1@@ -5140,7 +5140,7 @@ int define_ipv6_node_context(void)memset (newc,0 ,sizeof (ocontext_t)); -#ifdef DARWIN +#ifdef __APPLE__memcpy (&newc->u.node6.addr[0 ], &addr.s6_addr[0 ],16 );memcpy (&newc->u.node6.mask[0 ], &mask.s6_addr[0 ],16 );#else libsepol/Android.mk +0
-4@@ -69,10 +69,6 @@ common_cflags := \ -Wshadow -Wmissing-noreturn \ -Wmissing-format-attribute -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/include/ \ $(LOCAL_PATH)/src/ \libsepol/src/genbools.c +2
-2@@ -79,7 +79,7 @@ static int load_booleans(struct policydb *policydb, const char *path,if (boolf ==NULL ) goto localbool; -#ifdef DARWIN +#ifdef __APPLE__if ((buffer = (char *)malloc (255 *sizeof (char ))) ==NULL ) {ERR (NULL ,"out of memory" );return -1 ;@@ -111,7 +111,7 @@ static int load_booleans(struct policydb *policydb, const char *path, boolf =fopen (localbools,"r" );if (boolf !=NULL ) { -#ifdef DARWIN +#ifdef __APPLE__while (fgets (buffer,255 , boolf) !=NULL ) {#else libsepol/src/genusers.c +2
-2@@ -7,7 +7,7 @@#include <sepol/policydb/policydb.h> -#ifndef DARWIN +#ifndef __APPLE__#include <stdio_ext.h> #endif @@ -47,7 +47,7 @@ static int load_users(struct policydb *policydb, const char *path)if (fp ==NULL )return -1 ; -#ifdef DARWIN +#ifdef __APPLE__if ((buffer = (char *)malloc (255 *sizeof (char ))) ==NULL ) {ERR (NULL ,"out of memory" );return -1 ;libsepol/src/node_record.c +2
-2@@ -70,7 +70,7 @@ static int node_parse_addr(sepol_handle_t * handle,return STATUS_ERR ; } -#ifdef DARWIN +#ifdef __APPLE__memcpy (addr_bytes, in_addr.s6_addr,16 );#else memcpy (addr_bytes, in_addr.s6_addr32,16 );@@ -162,7 +162,7 @@ static int node_expand_addr(sepol_handle_t * handle, {struct in6_addr addr;memset (&addr,0 ,sizeof (struct in6_addr )); -#ifdef DARWIN +#ifdef __APPLE__memcpy (&addr.s6_addr[0 ], addr_bytes,16 );#else memcpy (&addr.s6_addr32[0 ], addr_bytes,16 );libsepol/src/private.h +2
-2@@ -5,7 +5,7 @@#include <sepol/policydb/policydb.h> -#ifdef DARWIN +#ifdef __APPLE__#include <sys/types.h> #include <machine/endian.h> #else @@ -16,7 +16,7 @@#include <errno.h> #include <dso.h> -#ifdef DARWIN +#ifdef __APPLE__#define __BYTE_ORDER BYTE_ORDER#define __LITTLE_ENDIAN LITTLE_ENDIAN#endif secilc/Android.mk +0
-5@@ -6,10 +6,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/../libsepol/cil/include/ \ $(LOCAL_PATH)/../libsepol/include/ \ --2.5.5
Signature · 2 lines
Elliott Hughes - http://who/enh - http://jessies.org/~enh/ Android native code/tools questions? Mail me/drop by/add me as a reviewer.
Quoted 5 lines · Stephen Smalley
As per discussion in https://android-review.googlesource.com/#/c/221980,
we should be using #ifdef__APPLE__rather than our own custom-defined DARWIN for building on MacOS X.Signed-off-by Stephen Smalley <[email protected]>
Quoted 174 lines
--- checkpolicy/Android.mk | 4 ---- checkpolicy/checkpolicy.c | 2 +- checkpolicy/policy_define.c | 2 +- libsepol/Android.mk | 4 ---- libsepol/src/genbools.c | 4 ++-- libsepol/src/genusers.c | 4 ++-- libsepol/src/node_record.c | 4 ++-- libsepol/src/private.h | 4 ++-- secilc/Android.mk | 4 ---- 9 files changed, 10 insertions(+), 22 deletions(-)checkpolicy/Android.mk +0
-4@@ -12,10 +12,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS),darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/ \ $(LOCAL_PATH)/../libsepol/include/ \checkpolicy/checkpolicy.c +1
-1@@ -73,7 +73,7 @@#include <errno.h> #include <sys/mman.h> -#ifdef DARWIN +#ifdef __APPLE__#include <ctype.h> #endif checkpolicy/policy_define.c +1
-1@@ -5140,7 +5140,7 @@ int define_ipv6_node_context(void)memset (newc,0 ,sizeof (ocontext_t)); -#ifdef DARWIN +#ifdef __APPLE__memcpy (&newc->u.node6.addr[0 ], &addr.s6_addr[0 ],16 );memcpy (&newc->u.node6.mask[0 ], &mask.s6_addr[0 ],16 );#else libsepol/Android.mk +0
-4@@ -69,10 +69,6 @@ common_cflags := \ -Wshadow -Wmissing-noreturn \ -Wmissing-format-attribute -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/include/ \ $(LOCAL_PATH)/src/ \libsepol/src/genbools.c +2
-2@@ -79,7 +79,7 @@ static int load_booleans(struct policydb *policydb, const char *path,if (boolf ==NULL ) goto localbool; -#ifdef DARWIN +#ifdef __APPLE__if ((buffer = (char *)malloc (255 *sizeof (char ))) ==NULL ) {ERR (NULL ,"out of memory" );return -1 ;@@ -111,7 +111,7 @@ static int load_booleans(struct policydb *policydb, const char *path, boolf =fopen (localbools,"r" );if (boolf !=NULL ) { -#ifdef DARWIN +#ifdef __APPLE__while (fgets (buffer,255 , boolf) !=NULL ) {#else libsepol/src/genusers.c +2
-2@@ -7,7 +7,7 @@#include <sepol/policydb/policydb.h> -#ifndef DARWIN +#ifndef __APPLE__#include <stdio_ext.h> #endif @@ -47,7 +47,7 @@ static int load_users(struct policydb *policydb, const char *path)if (fp ==NULL )return -1 ; -#ifdef DARWIN +#ifdef __APPLE__if ((buffer = (char *)malloc (255 *sizeof (char ))) ==NULL ) {ERR (NULL ,"out of memory" );return -1 ;libsepol/src/node_record.c +2
-2@@ -70,7 +70,7 @@ static int node_parse_addr(sepol_handle_t * handle,return STATUS_ERR ; } -#ifdef DARWIN +#ifdef __APPLE__memcpy (addr_bytes, in_addr.s6_addr,16 );#else memcpy (addr_bytes, in_addr.s6_addr32,16 );@@ -162,7 +162,7 @@ static int node_expand_addr(sepol_handle_t * handle, {struct in6_addr addr;memset (&addr,0 ,sizeof (struct in6_addr )); -#ifdef DARWIN +#ifdef __APPLE__memcpy (&addr.s6_addr[0 ], addr_bytes,16 );#else memcpy (&addr.s6_addr32[0 ], addr_bytes,16 );libsepol/src/private.h +2
-2@@ -5,7 +5,7 @@#include <sepol/policydb/policydb.h> -#ifdef DARWIN +#ifdef __APPLE__#include <sys/types.h> #include <machine/endian.h> #else @@ -16,7 +16,7 @@#include <errno.h> #include <dso.h> -#ifdef DARWIN +#ifdef __APPLE__#define __BYTE_ORDER BYTE_ORDER#define __LITTLE_ENDIAN LITTLE_ENDIAN#endif secilc/Android.mk +0
-5@@ -6,10 +6,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/../libsepol/cil/include/ \ $(LOCAL_PATH)/../libsepol/include/ \ --2.5.5
Signature · 1 line
Nick Kralevich | Android Security | [email protected] | 650.214.4037
LGTM, but have no way to test it. I have no apples.
Quoted 198 lines · Nick Kralevich
Quoted 5 lines · Stephen Smalley
As per discussion in https://android-review.googlesource.com/#/c/221980,
we should be using #ifdef__APPLE__rather than our own custom-defined DARWIN for building on MacOS X.Signed-off-by Stephen Smalley <[email protected]>Acked-by Nick Kralevich <[email protected]>libsepol/src/genbools.c static int load_booleans(struct policydb *policydb,
Quoted 73 lines
--- checkpolicy/Android.mk | 4 ---- checkpolicy/checkpolicy.c | 2 +- checkpolicy/policy_define.c | 2 +- libsepol/Android.mk | 4 ---- libsepol/src/genbools.c | 4 ++-- libsepol/src/genusers.c | 4 ++-- libsepol/src/node_record.c | 4 ++-- libsepol/src/private.h | 4 ++-- secilc/Android.mk | 4 ---- 9 files changed, 10 insertions(+), 22 deletions(-)checkpolicy/Android.mk +0
-4@@ -12,10 +12,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS),darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/ \ $(LOCAL_PATH)/../libsepol/include/ \checkpolicy/checkpolicy.c +1
-1@@ -73,7 +73,7 @@#include <errno.h> #include <sys/mman.h> -#ifdef DARWIN +#ifdef __APPLE__#include <ctype.h> #endif checkpolicy/policy_define.c +1
-1@@ -5140,7 +5140,7 @@ int define_ipv6_node_context(void)memset (newc,0 ,sizeof (ocontext_t)); -#ifdef DARWIN +#ifdef __APPLE__memcpy (&newc->u.node6.addr[0 ], &addr.s6_addr[0 ],16 );memcpy (&newc->u.node6.mask[0 ], &mask.s6_addr[0 ],16 );#else libsepol/Android.mk +0
-4@@ -69,10 +69,6 @@ common_cflags := \ -Wshadow -Wmissing-noreturn \ -Wmissing-format-attribute -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/include/ \ $(LOCAL_PATH)/src/ \libsepol/src/genbools.c +0
-0@@ -79,7 +79,7 @@ static int load_booleans(struct policydb *policydb,const char *path,
libsepol/src/genbools.c static int load_booleans(struct policydb *policydb,
Quoted 9 lines
libsepol/src/genbools.c +1
-1if (boolf ==NULL ) goto localbool; -#ifdef DARWIN +#ifdef __APPLE__if ((buffer = (char *)malloc (255 *sizeof (char ))) ==NULL ) {ERR (NULL ,"out of memory" );return -1 ;@@ -111,7 +111,7 @@ static int load_booleans(struct policydb *policydb,const char *path,
libsepol/src/genusers.c static int load_users(struct policydb *policydb, const
Quoted 22 lines
libsepol/src/genbools.c +1
-1boolf =fopen (localbools,"r" );if (boolf !=NULL ) { -#ifdef DARWIN +#ifdef __APPLE__while (fgets (buffer,255 , boolf) !=NULL ) {#else libsepol/src/genusers.c +1
-1@@ -7,7 +7,7 @@#include <sepol/policydb/policydb.h> -#ifndef DARWIN +#ifndef __APPLE__#include <stdio_ext.h> #endif @@ -47,7 +47,7 @@ static int load_users(struct policydb *policydb, constchar *path)
Quoted 68 lines
libsepol/src/genusers.c +1
-1if (fp ==NULL )return -1 ; -#ifdef DARWIN +#ifdef __APPLE__if ((buffer = (char *)malloc (255 *sizeof (char ))) ==NULL ) {ERR (NULL ,"out of memory" );return -1 ;libsepol/src/node_record.c +2
-2@@ -70,7 +70,7 @@ static int node_parse_addr(sepol_handle_t * handle,return STATUS_ERR ; } -#ifdef DARWIN +#ifdef __APPLE__memcpy (addr_bytes, in_addr.s6_addr,16 );#else memcpy (addr_bytes, in_addr.s6_addr32,16 );@@ -162,7 +162,7 @@ static int node_expand_addr(sepol_handle_t * handle, {struct in6_addr addr;memset (&addr,0 ,sizeof (struct in6_addr )); -#ifdef DARWIN +#ifdef __APPLE__memcpy (&addr.s6_addr[0 ], addr_bytes,16 );#else memcpy (&addr.s6_addr32[0 ], addr_bytes,16 );libsepol/src/private.h +2
-2@@ -5,7 +5,7 @@#include <sepol/policydb/policydb.h> -#ifdef DARWIN +#ifdef __APPLE__#include <sys/types.h> #include <machine/endian.h> #else @@ -16,7 +16,7 @@#include <errno.h> #include <dso.h> -#ifdef DARWIN +#ifdef __APPLE__#define __BYTE_ORDER BYTE_ORDER#define __LITTLE_ENDIAN LITTLE_ENDIAN#endif secilc/Android.mk +0
-5@@ -6,10 +6,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/../libsepol/cil/include/ \ $(LOCAL_PATH)/../libsepol/include/ \ --Quoted 2 lines
2.5.5
--
Nick Kralevich | Android Security | [email protected] | 650.214.4037
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].
Signature · 3 lines
Respectfully, William C Roberts