wayland_shm: Use correct filename in unlink

We switched from mkstemp to eina_file_mkstemp() but ended up unlinking
the template filename, which didn't exist on the filesystem.
This commit is contained in:
Derek Foreman 2016-07-26 12:22:36 -05:00
parent ed55b1f733
commit 8b87cd9e46
1 changed files with 4 additions and 2 deletions

View 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)