wayland_shm: Use correct filename in unlink
authorDerek Foreman <derekf@osg.samsung.com>
Tue, 26 Jul 2016 17:22:36 +0000 (12:22 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Tue, 26 Jul 2016 17:38:24 +0000 (12:38 -0500)
We switched from mkstemp to eina_file_mkstemp() but ended up unlinking
the template filename, which didn't exist on the filesystem.

src/modules/evas/engines/wayland_shm/evas_shm.c

index 92aae08..492f6be 100644 (file)
@@ -86,6 +86,7 @@ _shm_pool_make(struct wl_shm *shm, int size, void **data)
    const char *path;
    char *name;
    int fd = 0;
+   Eina_Tmpstr *fullname;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
@@ -108,7 +109,7 @@ _shm_pool_make(struct wl_shm *shm, int size, void **data)
 
    strcat(name, tmp);
 
-   fd = eina_file_mkstemp(name, NULL);
+   fd = eina_file_mkstemp(name, &fullname);
    if (fd < 0)
    /* try to create tmp file */
    /* if ((fd = mkstemp(name)) < 0) */
@@ -118,8 +119,9 @@ _shm_pool_make(struct wl_shm *shm, int size, void **data)
         return NULL;
      }
 
-   unlink(name);
+   unlink(fullname);
    free(name);
+   eina_tmpstr_del(fullname);
 
    /* try to truncate file to size */
    if (ftruncate(fd, size) < 0)