Put the Android security check in its own function

Bug: 9469682
Change-Id: I60253008333edd7c8f2efe63f31059dc22adda63
diff --git a/ping.c b/ping.c
index bf69fb0..23613c8 100644
--- a/ping.c
+++ b/ping.c
@@ -73,10 +73,6 @@
 };
 #endif
 
-#ifdef ANDROID
-#include <sys/auxv.h>
-#endif
-
 #define	MAXIPLEN	60
 #define	MAXICMPLEN	76
 #define	NROUTES		9		/* number of record route slots */
@@ -135,10 +131,7 @@
 	char rspace[3 + 4 * NROUTES + 1];	/* record route space */
 
 #ifdef ANDROID
-	if (getauxval(AT_SECURE) != 0) {
-		fprintf(stderr, "This version of ping should NOT run with privileges. Aborting\n");
-		exit(1);
-	}
+	android_check_security();
 #endif
 
 	limit_capabilities();