[gtk+/gtk-3-18] wayland: unlink shm file earlier in create function



commit 385b7ae0c8f6753cac86e9328d2f282bbe7591dc
Author: Ray Strode <rstrode redhat com>
Date:   Wed Jan 20 12:22:29 2016 -0500

    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

 gdk/wayland/gdkdisplay-wayland.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 64529fb..4f60573 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -992,6 +992,7 @@ create_shm_pool (struct wl_shm  *shm,
                   filename, g_strerror (errno));
       return NULL;
     }
+  unlink (filename);
 
   stride = width * 4;
   size = stride * height;
@@ -1004,7 +1005,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)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]