Add more debugging to cmd.
Test: manual
Change-Id: Ibb6c6dd99446504452921cb148d64461a6f0ef85
diff --git a/cmds/cmd/cmd.cpp b/cmds/cmd/cmd.cpp
index 40dbbf5..6511b44 100644
--- a/cmds/cmd/cmd.cpp
+++ b/cmds/cmd/cmd.cpp
@@ -72,6 +72,9 @@
aerr << "Open attempt after active for: " << fullPath << endl;
return -EPERM;
}
+#if DEBUG
+ ALOGD("openFile: %s, full=%s", path8.string(), fullPath.string());
+#endif
int flags = 0;
bool checkRead = false;
bool checkWrite = false;
@@ -92,6 +95,9 @@
return -EINVAL;
}
int fd = open(fullPath.string(), flags, S_IRWXU|S_IRWXG);
+#if DEBUG
+ ALOGD("openFile: fd=%d", fd);
+#endif
if (fd < 0) {
return fd;
}
@@ -104,6 +110,9 @@
int accessGranted = selinux_check_access(seLinuxContext8.string(), context.get(),
"file", "write", NULL);
if (accessGranted != 0) {
+#if DEBUG
+ ALOGD("openFile: failed selinux write check!");
+#endif
close(fd);
aerr << "System server has no access to write file context " << context.get()
<< " (from path " << fullPath.string() << ", context "
@@ -115,6 +124,9 @@
int accessGranted = selinux_check_access(seLinuxContext8.string(), context.get(),
"file", "read", NULL);
if (accessGranted != 0) {
+#if DEBUG
+ ALOGD("openFile: failed selinux read check!");
+#endif
close(fd);
aerr << "System server has no access to read file context " << context.get()
<< " (from path " << fullPath.string() << ", context "
@@ -164,6 +176,9 @@
proc->setThreadPoolMaxThreadCount(0);
proc->startThreadPool();
+#if DEBUG
+ ALOGD("cmd: starting");
+#endif
sp<IServiceManager> sm = defaultServiceManager();
fflush(stdout);
if (sm == NULL) {