From c1f73110acc1c13fd8e9117f4d9b965d73d13c09 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 6 Aug 2019 19:58:26 +0100 Subject: [PATCH] wl input - use eina mkstemp to handle umask right fix CID 1403927 --- src/bin/e_comp_wl_input.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c index 1f4a9ede9..8f89f6d14 100644 --- a/src/bin/e_comp_wl_input.c +++ b/src/bin/e_comp_wl_input.c @@ -324,6 +324,7 @@ _e_comp_wl_input_keymap_fd_get(void) char tmp[PATH_MAX]; long flags; void *mm; + Eina_Tmpstr *tmpstr = NULL; blen = sizeof(tmp) - 1; @@ -339,28 +340,33 @@ _e_comp_wl_input_keymap_fd_get(void) else return -1; - if ((fd = mkstemp(tmp)) < 0) return -1; + if ((fd = eina_file_mkstemp(tmp, &tmpstr)) < 0) return -1; flags = fcntl(fd, F_GETFD); if (flags < 0) { + eina_tmpstr_del(tmpstr); close(fd); return -1; } if (fcntl(fd, F_SETFD, (flags | FD_CLOEXEC)) == -1) { + eina_tmpstr_del(tmpstr); close(fd); return -1; } if (ftruncate(fd, e_comp_wl->xkb.map_size) < 0) { + eina_tmpstr_del(tmpstr); close(fd); return -1; } - unlink(tmp); + unlink(tmpstr); + eina_tmpstr_del(tmpstr); + mm = mmap(NULL, e_comp_wl->xkb.map_size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0); if (mm == MAP_FAILED)