posix_fallocate will fail if passed a 0 size, but we don't actually need
to call it if we have a 0 size, so return early.

Signed-off-by: Derek Foreman <der...@osg.samsung.com>
---
 cursor/os-compatibility.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cursor/os-compatibility.c b/cursor/os-compatibility.c
index d7d4b33..9791f97 100644
--- a/cursor/os-compatibility.c
+++ b/cursor/os-compatibility.c
@@ -129,6 +129,9 @@ os_create_anonymous_file(off_t size)
        if (fd < 0)
                return -1;
 
+       if (!size)
+               return fd;
+
 #ifdef HAVE_POSIX_FALLOCATE
        ret = posix_fallocate(fd, 0, size);
        if (ret != 0) {
-- 
2.7.0

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to