summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-07-26 12:34:27 -0500
committerDerek Foreman <derekf@osg.samsung.com>2016-07-26 12:38:24 -0500
commit3d5dbbfcd02fcef8c902573496ad1b668425f386 (patch)
tree5e63c5a66437cba95247e6954e622ef4e876d9c8
parent8b87cd9e465fbae14d47c145c588d500d6401f68 (diff)
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.
-rw-r--r--src/lib/elput/elput_evdev.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index cab7f8a..1b0ca1b 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -64,13 +64,14 @@ _keyboard_fd_get(off_t size)
64 char *path; 64 char *path;
65 char tmp[PATH_MAX]; 65 char tmp[PATH_MAX];
66 long flags; 66 long flags;
67 Eina_Tmpstr *fullname;
67 68
68 if (!(path = getenv("XDG_RUNTIME_DIR"))) 69 if (!(path = getenv("XDG_RUNTIME_DIR")))
69 return -1; 70 return -1;
70 71
71 snprintf(tmp, sizeof(tmp), "%s/elput-keymap-XXXXXX", path); 72 snprintf(tmp, sizeof(tmp), "%s/elput-keymap-XXXXXX", path);
72 73
73 fd = eina_file_mkstemp(tmp, NULL); 74 fd = eina_file_mkstemp(tmp, &fullname);
74 if (fd < 0) return -1; 75 if (fd < 0) return -1;
75 76
76 flags = fcntl(fd, F_GETFD); 77 flags = fcntl(fd, F_GETFD);
@@ -92,7 +93,8 @@ _keyboard_fd_get(off_t size)
92 return -1; 93 return -1;
93 } 94 }
94 95
95 unlink(tmp); 96 unlink(fullname);
97 eina_tmpstr_del(fullname);
96 return fd; 98 return fd;
97} 99}
98 100