blob: 915f6415360c0b1d68a3bd4f46e6195092535010 (
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
|
From cea8e6a01bb03bbe565c9bf5dd4f439f30ca953f Mon Sep 17 00:00:00 2001
From: Jan Beich <jbeich@FreeBSD.org>
Date: Fri, 28 Feb 2020 16:49:38 +0000
Subject: Bug 1618914 - [Wayland] Fall back to ftruncate if posix_fallocate isn't supported by filesystem.
--- widget/gtk/WaylandBuffer.cpp.orig 2021-08-31 14:09:31.912165000 +0200
+++ widget/gtk/WaylandBuffer.cpp 2021-08-31 14:20:08.723307000 +0200
@@ -72,7 +72,9 @@
do {
ret = posix_fallocate(fd, 0, aSize);
} while (ret == EINTR);
- if (ret != 0) {
+ if (ret == 0) {
+ return fd;
+ } else if (ret != ENODEV && ret != EINVAL && ret != EOPNOTSUPP) {
NS_WARNING(
nsPrintfCString("posix_fallocate() fails to allocate shm memory: %s",
strerror(ret))
@@ -80,7 +82,7 @@
close(fd);
return -1;
}
-#else
+#endif
do {
ret = ftruncate(fd, aSize);
} while (ret < 0 && errno == EINTR);
@@ -91,7 +93,6 @@
close(fd);
fd = -1;
}
-#endif
return fd;
}
|