bugreportz: don't write last line when it times out.
Bug: 112102388
Bug: 111720061
Test: m -j bugreportz_test && adb push \
${OUT}/data/nativetest/bugreportz_test/bugreportz_test /system/bin && \
adb shell /system/bin/bugreportz_test
Test: m -j bugreportz && adb push ${OUT}/system/bin/bugreportz /system/bin && \
adb shell setprop dumpstate.dry_run true && adb shell bugreportz -p
Change-Id: Ib4219d39070dc6958f83d4a2be34c212a9b1fe2b
diff --git a/cmds/bugreportz/bugreportz.cpp b/cmds/bugreportz/bugreportz.cpp
index 75855cf..ded0ed3 100644
--- a/cmds/bugreportz/bugreportz.cpp
+++ b/cmds/bugreportz/bugreportz.cpp
@@ -55,7 +55,7 @@
errno = ETIMEDOUT;
}
printf("FAIL:Bugreport read terminated abnormally (%s)\n", strerror(errno));
- break;
+ return EXIT_FAILURE;
}
// Writes line by line.
@@ -71,8 +71,5 @@
// Process final line, in case it didn't finish with newline
write_line(line, show_progress);
- if (close(s) == -1) {
- fprintf(stderr, "WARNING: error closing socket: %s\n", strerror(errno));
- }
return EXIT_SUCCESS;
}