View | Details | Raw Unified | Return to bug 254919 | Differences between
and this patch

Collapse All | Expand All

(-)b/x11/libxkbcommon/files/patch-tools_interactive-wayland.c (+32 lines)
Added Link Here
1
--- tools/interactive-wayland.c.orig	2021-04-07 16:27:51 UTC
2
+++ tools/interactive-wayland.c
3
@@ -181,20 +181,26 @@ os_create_anonymous_file(off_t size)
4
         return -1;
5
 
6
 #ifdef HAVE_POSIX_FALLOCATE
7
+    /* Filesystems that do not support posix_fallocate()
8
+     * will return EINVAL or EOPNOTSUPP, fallback to
9
+     * ftruncate() then
10
+     */
11
     ret = posix_fallocate(fd, 0, size);
12
-    if (ret != 0) {
13
+    if (ret != 0 && ret != EINVAL && ret != EOPNOTSUPP) {
14
         close(fd);
15
         errno = ret;
16
         return -1;
17
     }
18
+    if (ret != 0)
19
+        ret = ftruncate(fd, size);
20
 #else
21
     ret = ftruncate(fd, size);
22
+#endif
23
     if (ret < 0) {
24
         close(fd);
25
+        errno = ret;
26
         return -1;
27
     }
28
-#endif
29
-
30
     return fd;
31
 }
32
 

Return to bug 254919