summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorGeremy Condra <gcondra@google.com>2013-04-04 23:42:15 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-04 23:42:15 -0700
commite167d889e4917e6b4f569026a1492b9e9818b08e (patch)
tree7167b30d505e5e4596a1eb34fcf6793a2e0840dd /cmds
parentdff2f699e16635c44472b0e4f2a3176e4f061367 (diff)
parenta3d3e137f473a965fefced9670e3b0c6b5f7f791 (diff)
downloadframeworks_native-e167d889e4917e6b4f569026a1492b9e9818b08e.zip
frameworks_native-e167d889e4917e6b4f569026a1492b9e9818b08e.tar.gz
frameworks_native-e167d889e4917e6b4f569026a1492b9e9818b08e.tar.bz2
am a3d3e137: Merge "dumpstate: Add SELinux restorecon call."
* commit 'a3d3e137f473a965fefced9670e3b0c6b5f7f791': dumpstate: Add SELinux restorecon call.
Diffstat (limited to 'cmds')
-rw-r--r--cmds/dumpstate/Android.mk2
-rw-r--r--cmds/dumpstate/utils.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk
index 18685f7..8640983 100644
--- a/cmds/dumpstate/Android.mk
+++ b/cmds/dumpstate/Android.mk
@@ -9,7 +9,7 @@ LOCAL_SRC_FILES := dumpstate.c utils.c
LOCAL_MODULE := dumpstate
-LOCAL_SHARED_LIBRARIES := libcutils
+LOCAL_SHARED_LIBRARIES := libcutils libselinux
ifdef BOARD_LIB_DUMPSTATE
LOCAL_STATIC_LIBRARIES := $(BOARD_LIB_DUMPSTATE)
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index 9b0013e..fe716ac 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -38,6 +38,8 @@
#include <cutils/sockets.h>
#include <private/android_filesystem_config.h>
+#include <selinux/android.h>
+
#include "dumpstate.h"
/* list of native processes to include in the native dumps */
@@ -467,6 +469,9 @@ const char *dump_traces() {
if (!mkdir(anr_traces_dir, 0775)) {
chown(anr_traces_dir, AID_SYSTEM, AID_SYSTEM);
chmod(anr_traces_dir, 0775);
+ if (selinux_android_restorecon(anr_traces_dir) == -1) {
+ fprintf(stderr, "restorecon failed for %s: %s\n", anr_traces_dir, strerror(errno));
+ }
} else if (errno != EEXIST) {
fprintf(stderr, "mkdir(%s): %s\n", anr_traces_dir, strerror(errno));
return NULL;