diff options
author | Christopher Ferris <cferris@google.com> | 2017-08-11 02:04:47 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-08-11 02:04:47 +0000 |
commit | 30438e4cea83628bcacbedff37a35398bb8b40e7 (patch) | |
tree | d0dab96c8f737ae4058b1e144ced6418823b5b77 /benchmarks/stdio_benchmark.cpp | |
parent | 73c3be22199a42bed53245b9b648e276de0b6422 (diff) | |
parent | a98a5fb63ee00bbd7f1663192453efcdf117cb92 (diff) |
Merge "Improve error handling and fix minor bugs in bionic benchmarks."
Diffstat (limited to 'benchmarks/stdio_benchmark.cpp')
-rw-r--r-- | benchmarks/stdio_benchmark.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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 <err.h> #include <stdio.h> #include <stdio_ext.h> #include <stdlib.h> @@ -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); } } |