am 3f669e07: am 59be5aed: Merge "libziparchive: fix fallocate failures"

* commit '3f669e078b03a5e9452e455c5496d050f10ae402':
  libziparchive: fix fallocate failures
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index 79c4c53..b2a9f88 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -1008,8 +1008,13 @@
       // entry. Note that the call to ftruncate below will change the file size but
       // will not allocate space on disk and this call to fallocate will not
       // change the file size.
+      // Note: fallocate is only supported by the following filesystems -
+      // btrfs, ext4, ocfs2, and xfs. Therefore fallocate might fail with
+      // EOPNOTSUPP error when issued in other filesystems.
+      // Hence, check for the return error code before concluding that the
+      // disk does not have enough space.
       result = TEMP_FAILURE_RETRY(fallocate(fd, 0, current_offset, declared_length));
-      if (result == -1) {
+      if (result == -1 && errno == ENOSPC) {
         ALOGW("Zip: unable to allocate space for file to %" PRId64 ": %s",
               static_cast<int64_t>(declared_length + current_offset), strerror(errno));
         return std::unique_ptr<FileWriter>(nullptr);