Silence unused result warnings in art.
This lets us turn on _FORTIFY_SOURCE=2 for the host.
The logging change is basically a trick (since we're still ignoring the
result unless it's an EINTR failure).
The profiler change is in a function whose error checking is a mess; the
fd is leaked, and it's not clear what's supposed to happen about the flock
on failure. I didn't exit if the ftruncate fails because the rest of the
function just blunders on, and error handling here needs a deeper rethink.
Bug: http://b/20558757
Change-Id: I7a2873fce08e37f4af826a04b4701d7ac6a8e3fa
diff --git a/runtime/profiler.cc b/runtime/profiler.cc
index 90a47b3..63a3843 100644
--- a/runtime/profiler.cc
+++ b/runtime/profiler.cc
@@ -300,7 +300,9 @@
} while (length > 0);
// Truncate the file to the new length.
- ftruncate(fd, full_length);
+ if (ftruncate(fd, full_length) == -1) {
+ LOG(ERROR) << "Failed to truncate profile file " << full_name;
+ }
// Now unlock the file, allowing another process in.
err = flock(fd, LOCK_UN);