summaryrefslogtreecommitdiffstats
path: root/logcat
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2017-02-21 14:45:58 -0800
committerBo Hu <bohu@google.com>2017-02-22 01:21:02 +0000
commitf9dbdbc5f5e2ecfe62617a866b1b18bbd8eb0dbf (patch)
treefb303df110a2bbaecda2b58e1c152a44b9f6b891 /logcat
parentb63d47356a6c87e88ef83da3325ccf81a7b3a410 (diff)
downloadsystem_core-f9dbdbc5f5e2ecfe62617a866b1b18bbd8eb0dbf.tar.gz
system_core-f9dbdbc5f5e2ecfe62617a866b1b18bbd8eb0dbf.tar.bz2
system_core-f9dbdbc5f5e2ecfe62617a866b1b18bbd8eb0dbf.zip
liblogcat: redirect logcat output correctly for -Q
The -Q option is used in emulator and it fails to redirect the output of logcat to the desired file. This CL fixes that problem. There is no gTest because of /proc/cmdline sniffing for this option. manually tested on /dev/qemu_pipe inside emulator Test: manual Bug: 35326290 Change-Id: I282da685e90450aadb2a989a0517dc3b1bb6634d
Diffstat (limited to 'logcat')
-rw-r--r--logcat/logcat.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index 15cef1ac2..7f852d4fb 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -1231,8 +1231,11 @@ static int __logcat(android_logcat_context_internal* context) {
android::close_error(context);
context->stderr_stdout = true;
context->output = fp;
- context->error = context->output;
- if (context->stderr_null) context->error = NULL;
+ context->output_fd = fileno(fp);
+ if (context->stderr_null) break;
+ context->stderr_stdout = true;
+ context->error = fp;
+ context->error_fd = fileno(fp);
}
break;