liblogcat: avoid double close.
Bug: http://b/67960705
Test: mma
Change-Id: I0b9015f0b4e64631a3476966decce3b6210bb801
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index 3d56472..07981fc 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -1831,11 +1831,10 @@
}
android::close_output(context);
android::close_error(context);
+
if (context->fds[1] >= 0) {
- // NB: could be closed by the above fclose(s), ignore error.
- int save_errno = errno;
+ // NB: this should be closed by close_output, but just in case...
close(context->fds[1]);
- errno = save_errno;
context->fds[1] = -1;
}