elput: 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:34:27 -05:00
parent 8b87cd9e46
commit 3d5dbbfcd0
1 changed files with 4 additions and 2 deletions

View File

@ -64,13 +64,14 @@ _keyboard_fd_get(off_t size)
char *path;
char tmp[PATH_MAX];
long flags;
Eina_Tmpstr *fullname;
if (!(path = getenv("XDG_RUNTIME_DIR")))
return -1;
snprintf(tmp, sizeof(tmp), "%s/elput-keymap-XXXXXX", path);
fd = eina_file_mkstemp(tmp, NULL);
fd = eina_file_mkstemp(tmp, &fullname);
if (fd < 0) return -1;
flags = fcntl(fd, F_GETFD);
@ -92,7 +93,8 @@ _keyboard_fd_get(off_t size)
return -1;
}
unlink(tmp);
unlink(fullname);
eina_tmpstr_del(fullname);
return fd;
}