diff options
author | Nick Kralevich <nnk@google.com> | 2014-03-26 16:36:38 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-26 16:36:38 +0000 |
commit | 9cddbd258d24029a6498898e96cb53aa62349767 (patch) | |
tree | b060a99713f1d36ec66992f9b184390e9e2914b1 | |
parent | f3ed9a21b83df1e1b4aa8d2cdd08114de3484b59 (diff) | |
parent | d9ee7dee2cf42c0e672c7ac85c0252a22d3e5f08 (diff) | |
download | frameworks_native-9cddbd258d24029a6498898e96cb53aa62349767.zip frameworks_native-9cddbd258d24029a6498898e96cb53aa62349767.tar.gz frameworks_native-9cddbd258d24029a6498898e96cb53aa62349767.tar.bz2 |
am d9ee7dee: am b1a8c016: Merge "Send libselinux logging to logcat."
* commit 'd9ee7dee2cf42c0e672c7ac85c0252a22d3e5f08':
Send libselinux logging to logcat.
-rw-r--r-- | cmds/installd/installd.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c index 40fc13f..a080ee6 100644 --- a/cmds/installd/installd.c +++ b/cmds/installd/installd.c @@ -541,6 +541,27 @@ static void drop_privileges() { } } +static int log_callback(int type, const char *fmt, ...) { + va_list ap; + int priority; + + switch (type) { + case SELINUX_WARNING: + priority = ANDROID_LOG_WARN; + break; + case SELINUX_INFO: + priority = ANDROID_LOG_INFO; + break; + default: + priority = ANDROID_LOG_ERROR; + break; + } + va_start(ap, fmt); + LOG_PRI_VA(priority, "SELinux", fmt, ap); + va_end(ap); + return 0; +} + int main(const int argc, const char *argv[]) { char buf[BUFFER_MAX]; struct sockaddr addr; @@ -550,6 +571,10 @@ int main(const int argc, const char *argv[]) { ALOGI("installd firing up\n"); + union selinux_callback cb; + cb.func_log = log_callback; + selinux_set_callback(SELINUX_CB_LOG, cb); + if (initialize_globals() < 0) { ALOGE("Could not initialize globals; exiting.\n"); exit(1); |