forked from enlightenment/efl
edje_watch: Use eina_file_mkstemp() to avoid problems with umask
CID 1039617
This commit is contained in:
parent
f55572d79e
commit
7d8c846d01
|
@ -17,7 +17,7 @@
|
||||||
# define WEXITSTATUS(r) r
|
# define WEXITSTATUS(r) r
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char watchfile[PATH_MAX];
|
static Eina_Tmpstr *watchfile;
|
||||||
static char *edje_cc_command = NULL;
|
static char *edje_cc_command = NULL;
|
||||||
static Eina_List *watching = NULL;
|
static Eina_List *watching = NULL;
|
||||||
static Ecore_Timer *timeout = NULL;
|
static Ecore_Timer *timeout = NULL;
|
||||||
|
@ -102,7 +102,6 @@ some_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSE
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *watchout;
|
|
||||||
Eina_Strbuf *buf;
|
Eina_Strbuf *buf;
|
||||||
int tfd;
|
int tfd;
|
||||||
int i;
|
int i;
|
||||||
|
@ -112,21 +111,13 @@ main(int argc, char **argv)
|
||||||
eio_init();
|
eio_init();
|
||||||
|
|
||||||
if (argc < 2) return -1;
|
if (argc < 2) return -1;
|
||||||
|
|
||||||
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, some_change, NULL);
|
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, some_change, NULL);
|
||||||
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, some_change, NULL);
|
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, some_change, NULL);
|
||||||
ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, some_change, NULL);
|
ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, some_change, NULL);
|
||||||
ecore_event_handler_add(EIO_MONITOR_FILE_CLOSED, some_change, NULL);
|
ecore_event_handler_add(EIO_MONITOR_FILE_CLOSED, some_change, NULL);
|
||||||
|
|
||||||
#ifdef HAVE_EVIL
|
tfd = eina_file_mkstemp("edje_watch-tmp-XXXXXX", &watchfile);
|
||||||
watchout = (char *)evil_tmpdir_get();
|
|
||||||
#else
|
|
||||||
watchout = "/tmp";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
snprintf(watchfile, PATH_MAX, "%s/edje_watch-tmp-XXXXXX", watchout);
|
|
||||||
|
|
||||||
tfd = mkstemp(watchfile);
|
|
||||||
if (tfd < 0) return -1;
|
if (tfd < 0) return -1;
|
||||||
close(tfd);
|
close(tfd);
|
||||||
|
|
||||||
|
@ -151,6 +142,7 @@ main(int argc, char **argv)
|
||||||
ecore_main_loop_begin();
|
ecore_main_loop_begin();
|
||||||
|
|
||||||
unlink(watchfile);
|
unlink(watchfile);
|
||||||
|
eina_tmpstr_del(watchfile);
|
||||||
|
|
||||||
eio_shutdown();
|
eio_shutdown();
|
||||||
ecore_shutdown();
|
ecore_shutdown();
|
||||||
|
|
Loading…
Reference in New Issue