aboutsummaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-bug1618914
blob: a2966b44f5e7c72dfd58d5e7ab7a0581deee0f4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[Wayland] Fall back to ftruncate if posix_fallocate isn't supported by filesystem.

diff --git widget/gtk/WindowSurfaceWayland.cpp widget/gtk/WindowSurfaceWayland.cpp
index 9a73326399bd5..9e42a7f1c5d18 100644
--- widget/gtk/WindowSurfaceWayland.cpp
+++ widget/gtk/WindowSurfaceWayland.cpp
@@ -235,23 +235,24 @@
 #ifdef HAVE_POSIX_FALLOCATE
   do {
     ret = posix_fallocate(fd, 0, aSize);
   } while (ret == EINTR);
-  if (ret != 0) {
+  if (ret == 0) {
+    return fd;
+  } else if (ret != EINVAL && ret != EOPNOTSUPP) {
     close(fd);
     MOZ_CRASH_UNSAFE_PRINTF(
         "posix_fallocate() fails on %s size %d error code %d\n", filename,
         aSize, ret);
   }
-#else
+#endif
   do {
     ret = ftruncate(fd, aSize);
   } while (ret < 0 && errno == EINTR);
   if (ret < 0) {
     close(fd);
     MOZ_CRASH_UNSAFE_PRINTF("ftruncate() fails on %s size %d error code %d\n",
                             filename, aSize, ret);
   }
-#endif
 
   return fd;
 }
@@ -265,7 +266,7 @@ bool WaylandShmPool::Resize(int aSize) {
   do {
     errno = posix_fallocate(mShmPoolFd, 0, aSize);
   } while (errno == EINTR);
-  if (errno != 0) return false;
+  if (errno != 0 && errno != EINVAL && errno != EOPNOTSUPP) return false;
 #endif
 
   wl_shm_pool_resize(mShmPool, aSize);