broadway: Ensure we allocate shm surface space early

This is nicer then getting random sigbus later
This commit is contained in:
Alexander Larsson 2013-04-03 15:50:54 +02:00
parent c340dfeaf8
commit 8084e6e468

View File

@ -582,6 +582,13 @@ _gdk_broadway_server_create_surface (int width,
res = ftruncate (fd, data->data_size);
g_assert (res != -1);
res = posix_fallocate (fd, 0, data->data_size);
if (res != 0)
{
shm_unlink (data->name);
g_error ("Not enough shared memory for window surface");
}
data->data = mmap(0, data->data_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
(void) close(fd);