From a98a5fb63ee00bbd7f1663192453efcdf117cb92 Mon Sep 17 00:00:00 2001 From: Anders Lewis Date: Wed, 9 Aug 2017 16:52:19 -0700 Subject: Improve error handling and fix minor bugs in bionic benchmarks. Test: Unit tests. Change-Id: I224ae4c7f195176eb8a87deddb2debcbf0f24ba3 --- benchmarks/stdio_benchmark.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'benchmarks/stdio_benchmark.cpp') diff --git a/benchmarks/stdio_benchmark.cpp b/benchmarks/stdio_benchmark.cpp index a1ca60e8a..2ab7264a0 100644 --- a/benchmarks/stdio_benchmark.cpp +++ b/benchmarks/stdio_benchmark.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include #include @@ -68,7 +69,9 @@ static void FopenFgetsFclose(benchmark::State& state, bool no_locking) { while (state.KeepRunning()) { FILE* fp = fopen("/dev/zero", "re"); if (no_locking) __fsetlocking(fp, FSETLOCKING_BYCALLER); - if (fgets(buf, sizeof(buf), fp) == nullptr) abort(); + if (fgets(buf, sizeof(buf), fp) == nullptr) { + errx(1, "ERROR: fgets of %zu bytes failed.", nbytes); + } fclose(fp); } } -- cgit v1.2.3