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

Return to bug 254919