summaryrefslogtreecommitdiff
path: root/src/bin/efreet/efreetd.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2015-07-22 05:44:50 +0200
committerTom Hacohen <tom@stosb.com>2015-07-22 09:22:02 +0100
commiteeb259303f720c1981efa52d5e1a6fba6708aff6 (patch)
tree55314aadd6df87dbfd78ff11a6cfdcd5f13ddd3a /src/bin/efreet/efreetd.c
parent0b579f1f49ccc9ae7edd40d09a51720272d90774 (diff)
Efreet: use eina_file_mkstemp() instead of mkstemp in efreetd.c
Diffstat (limited to '')
-rw-r--r--src/bin/efreet/efreetd.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/bin/efreet/efreetd.c b/src/bin/efreet/efreetd.c
index ffb15a09c3..aed2996654 100644
--- a/src/bin/efreet/efreetd.c
+++ b/src/bin/efreet/efreetd.c
@@ -29,7 +29,6 @@ main(int argc, char *argv[])
29 char path[PATH_MAX]; 29 char path[PATH_MAX];
30 FILE *log; 30 FILE *log;
31 int fd; 31 int fd;
32 mode_t um;
33 32
34#ifdef HAVE_SYS_RESOURCE_H 33#ifdef HAVE_SYS_RESOURCE_H
35 setpriority(PRIO_PROCESS, 0, 19); 34 setpriority(PRIO_PROCESS, 0, 19);
@@ -37,19 +36,19 @@ main(int argc, char *argv[])
37 SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); 36 SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
38#endif 37#endif
39 38
40 strcpy(path, "/tmp/efreetd_XXXXXX"); 39 if (!eina_init()) return 1;
41 um = umask(S_IRWXG | S_IRWXO); 40
42 fd = mkstemp(path); 41 snprintf(path, sizeof(path), "efreetd_XXXXXX");
43 umask(um); 42 fd = eina_file_mkstemp(path, NULL);
44 if (fd < 0) 43 if (fd < 0)
45 { 44 {
46 perror("mkstemp"); 45 perror("mkstemp");
47 return 1; 46 goto ecore_error;
48 } 47 }
49 log = fdopen(fd, "wb"); 48 log = fdopen(fd, "wb");
50 if (!log) return 1; 49 if (!log)
50 goto ecore_error;
51 51
52 if (!eina_init()) return 1;
53 eina_log_print_cb_set(eina_log_print_cb_file, log); 52 eina_log_print_cb_set(eina_log_print_cb_file, log);
54 efreetd_log_dom = eina_log_domain_register("efreetd", EFREETD_DEFAULT_LOG_COLOR); 53 efreetd_log_dom = eina_log_domain_register("efreetd", EFREETD_DEFAULT_LOG_COLOR);
55 if (efreetd_log_dom < 0) 54 if (efreetd_log_dom < 0)