Loading logcat/logcat.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -1831,11 +1831,10 @@ int android_logcat_destroy(android_logcat_context* ctx) { } 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; } Loading logcat/logcat_system.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #include <ctype.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <unistd.h> Loading Loading @@ -98,8 +99,12 @@ FILE* android_logcat_popen(android_logcat_context* ctx, const char* command) { return NULL; } FILE* retval = fdopen(fd, "reb"); if (!retval) android_logcat_destroy(ctx); int duped = dup(fd); FILE* retval = fdopen(duped, "reb"); if (!retval) { close(duped); android_logcat_destroy(ctx); } return retval; } Loading Loading
logcat/logcat.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -1831,11 +1831,10 @@ int android_logcat_destroy(android_logcat_context* ctx) { } 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; } Loading
logcat/logcat_system.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #include <ctype.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <unistd.h> Loading Loading @@ -98,8 +99,12 @@ FILE* android_logcat_popen(android_logcat_context* ctx, const char* command) { return NULL; } FILE* retval = fdopen(fd, "reb"); if (!retval) android_logcat_destroy(ctx); int duped = dup(fd); FILE* retval = fdopen(duped, "reb"); if (!retval) { close(duped); android_logcat_destroy(ctx); } return retval; } Loading