update_engine: Use utils::FileSize when finding the size of a file.

The utils::FileSize funciton can find the size of a block device correctly.
Use it instead of the adhoc methods used around the codebase.

BUG=chromium:415867
TEST=Ran a butterfly-paladin tryjob with --hwtest.

Change-Id: Id6fd37f04b136b4265bde9b1f56c379a5d9c30f9
Reviewed-on: https://chromium-review.googlesource.com/217418
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
diff --git a/download_action.cc b/download_action.cc
index 5b3ffeb..6871f60 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -117,15 +117,15 @@
   //  1. the p2p file didn't get properly synced to stable storage; or
   //  2. the file was deleted at bootup (it's in /var/cache after all); or
   //  3. other reasons
-  struct stat statbuf;
-  if (fstat(p2p_sharing_fd_, &statbuf) != 0) {
+  off_t p2p_size = utils::FileSize(p2p_sharing_fd_);
+  if (p2p_size < 0) {
     PLOG(ERROR) << "Error getting file status for p2p file";
     CloseP2PSharingFd(true);  // Delete p2p file.
     return;
   }
-  if (statbuf.st_size < file_offset) {
+  if (p2p_size < file_offset) {
     LOG(ERROR) << "Wanting to write to file offset " << file_offset
-               << " but existing p2p file is only " << statbuf.st_size
+               << " but existing p2p file is only " << p2p_size
                << " bytes.";
     CloseP2PSharingFd(true);  // Delete p2p file.
     return;