fallocate() returning ENOSYS is okay.
Jeff Sharkey [Tue, 26 Aug 2014 20:56:12 +0000 (13:56 -0700)]
Fall back just like ENOTSUP.

Bug: 17285472
Change-Id: Ice4954726c14a0e84c39c5469d573644588934ae

src/com/android/providers/downloads/DownloadThread.java

index 88f554e..aa0190b 100644 (file)
@@ -467,8 +467,8 @@ public class DownloadThread implements Runnable {
                         // We found enough space, so claim it for ourselves
                         Os.posix_fallocate(outFd, 0, mInfoDelta.mTotalBytes);
                     } catch (ErrnoException e) {
-                        if (e.errno == OsConstants.ENOTSUP) {
-                            Log.w(TAG, "fallocate() said ENOTSUP; falling back to ftruncate()");
+                        if (e.errno == OsConstants.ENOSYS || e.errno == OsConstants.ENOTSUP) {
+                            Log.w(TAG, "fallocate() not supported; falling back to ftruncate()");
                             Os.ftruncate(outFd, mInfoDelta.mTotalBytes);
                         } else {
                             throw e;