OSDN Git Service

Fix static linkage of toybox binary.
authorAlistair Strachan <alistair.strachan@imgtec.com>
Thu, 5 May 2016 23:11:35 +0000 (16:11 -0700)
committerRob Landley <rob@landley.net>
Fri, 6 May 2016 03:10:37 +0000 (22:10 -0500)
If toybox was compiled statically e.g. for use in a recovery ramdisk,
it would not build after b66a29a. This is because libselinux already
exports a selinux_log_callback() function which getprop.c is trying
to override.

This change simply makes the second symbol static, since it is only
used in a function table so we do not actually need to export it
from toybox.

Change-Id: I603258877ae2286660df35738bbf4f4285df5b54
Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
toys/android/getprop.c

index cce53a6..2df6c0a 100644 (file)
@@ -52,7 +52,8 @@ static void add_property(char *name, char *value, void *unused)
 }
 
 // Needed to supress extraneous "Loaded property_contexts from" message
-int selinux_log_callback(int type, const char *fmt, ...) {
+static int selinux_log_callback_local(int type, const char *fmt, ...)
+{
   va_list ap;
 
   if (type == SELINUX_INFO) return 0;
@@ -67,7 +68,7 @@ void getprop_main(void)
   if (toys.optflags & FLAG_Z) {
     union selinux_callback cb;
 
-    cb.func_log = selinux_log_callback;
+    cb.func_log = selinux_log_callback_local;
     selinux_set_callback(SELINUX_CB_LOG, cb);
     TT.handle = selinux_android_prop_context_handle();
     if (!TT.handle) error_exit("unable to get selinux property context handle");