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
This commit is contained in:
Mark Salyzyn 2017-02-21 14:45:58 -08:00 committed by Bo Hu
parent b63d47356a
commit f9dbdbc5f5
1 changed files with 5 additions and 2 deletions

View File

@ -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;