am f044a21a: Merge "Fix unused result warnings in system/extras/verity."

* commit 'f044a21af13472bed9d74b96829a0e5597af0a7a':
  Fix unused result warnings in system/extras/verity.
diff --git a/verity/Android.mk b/verity/Android.mk
index 46396ca..bbe74bb 100644
--- a/verity/Android.mk
+++ b/verity/Android.mk
@@ -98,6 +98,6 @@
 LOCAL_SRC_FILES := build_verity_tree.cpp
 LOCAL_MODULE_TAGS := optional
 LOCAL_STATIC_LIBRARIES := libsparse_host libz
-LOCAL_SHARED_LIBRARIES := libcrypto-host
+LOCAL_SHARED_LIBRARIES := libcrypto-host libbase
 LOCAL_CFLAGS += -Wall -Werror
 include $(BUILD_HOST_EXECUTABLE)
diff --git a/verity/build_verity_tree.cpp b/verity/build_verity_tree.cpp
index e7bfa40..5a6a6ee 100644
--- a/verity/build_verity_tree.cpp
+++ b/verity/build_verity_tree.cpp
@@ -16,6 +16,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <base/file.h>
+
 struct sparse_hash_ctx {
     unsigned char *hashes;
     const unsigned char *salt;
@@ -353,7 +355,9 @@
     if (fd < 0) {
         FATAL("failed to open output file '%s'\n", verity_filename);
     }
-    write(fd, verity_tree, verity_blocks * block_size);
+    if (!android::base::WriteFully(fd, verity_tree, verity_blocks * block_size)) {
+        FATAL("failed to write '%s'\n", verity_filename);
+    }
     close(fd);
 
     delete[] verity_tree_levels;