forked from AuroraMiddleware/gtk
wayland: unlink shm file earlier in create function
create_shm_pool unlinks the temporary file a little, too late. It should be unlinked before ftruncate() is called for two reasons: 1) if ftruncate fails, the file is currently not getting cleaned up at all 2) in theory, if the file is public some other process could muck with it This commit just moves the unlink call a little higher up. https://bugzilla.gnome.org/show_bug.cgi?id=760897
This commit is contained in:
parent
6c1bee2377
commit
c8deaeabdd
@ -941,6 +941,7 @@ create_shm_pool (struct wl_shm *shm,
|
||||
filename, g_strerror (errno));
|
||||
return NULL;
|
||||
}
|
||||
unlink (filename);
|
||||
|
||||
stride = width * 4;
|
||||
size = stride * height;
|
||||
@ -953,7 +954,6 @@ create_shm_pool (struct wl_shm *shm,
|
||||
}
|
||||
|
||||
data = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
unlink (filename);
|
||||
|
||||
if (data == MAP_FAILED)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user