When shm buffers are remote the server library will create empty fds for
them.  We need to handle resizing of that for both pool creation and
resize (in a local connection this is done by the client app)

Signed-off-by: Derek Foreman <[email protected]>
---
 src/wayland-shm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/wayland-shm.c b/src/wayland-shm.c
index 911165d..d6566bf 100644
--- a/src/wayland-shm.c
+++ b/src/wayland-shm.c
@@ -42,6 +42,7 @@
 
 #include "wayland-private.h"
 #include "wayland-server.h"
+#include "wayland-os.h"
 
 /* This once_t is used to synchronize installing the SIGBUS handler
  * and creating the TLS key. This will be done in the first call
@@ -201,6 +202,9 @@ shm_pool_resize(struct wl_client *client, struct 
wl_resource *resource,
        struct wl_shm_pool *pool = wl_resource_get_user_data(resource);
        void *data;
 
+       if (wl_client_is_remote(client))
+               wl_os_resize_file(pool->fd, size);
+
        if (size < pool->size) {
                wl_resource_post_error(resource,
                                       WL_SHM_ERROR_INVALID_FD,
@@ -232,6 +236,9 @@ shm_create_pool(struct wl_client *client, struct 
wl_resource *resource,
 {
        struct wl_shm_pool *pool;
 
+       if (wl_client_is_remote(client))
+               wl_os_resize_file(fd, size);
+
        pool = malloc(sizeof *pool);
        if (pool == NULL) {
                wl_client_post_no_memory(client);
-- 
2.7.0

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to