From 61c9991eef4ece13e45c567905c48d3e9a829a09 Mon Sep 17 00:00:00 2001 From: "Prudhvi Raj, Vasireddi" Date: Mon, 21 Mar 2016 21:11:12 +0900 Subject: [PATCH] Evas GL: Fix aarch64 build error in 'run-time generation and load of shaders' patch Change-Id: Iae81201874de496a41c3a868b786ceed30487bcf --- src/lib/eina/eina_file_common.c | 58 ++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c index 8314f00..cdb9ba9 100644 --- a/src/lib/eina/eina_file_common.c +++ b/src/lib/eina/eina_file_common.c @@ -913,7 +913,8 @@ EAPI int eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path) { char buffer[PATH_MAX]; - const char *XXXXXX = NULL, *sep; + const char *tmpdir = NULL; + const char *XXXXXX = NULL; int fd, len; #ifndef _WIN32 mode_t old_umask; @@ -921,19 +922,23 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path) EINA_SAFETY_ON_NULL_RETURN_VAL(templatename, -1); - sep = strchr(templatename, '/'); -#ifdef _WIN32 - if (!sep) sep = strchr(templatename, '\\'); -#endif - if (sep) - { - len = eina_strlcpy(buffer, templatename, sizeof(buffer)); - } - else +# if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +# endif { - len = eina_file_path_join(buffer, sizeof(buffer), - eina_environment_tmp_get(), templatename); + tmpdir = getenv("TMPDIR"); + if (!tmpdir) tmpdir = getenv("XDG_RUNTIME_DIR"); } + if (!tmpdir) tmpdir = "/tmp"; + +#ifdef _WIN32 + if (strchr(templatename, '\\')) +#else + if (strchr(templatename, '/')) +#endif + len = snprintf(buffer, PATH_MAX, "%s", templatename); +else + len = snprintf(buffer, PATH_MAX, "%s/%s", tmpdir, templatename); /* * Unix: @@ -972,23 +977,28 @@ EAPI Eina_Bool eina_file_mkdtemp(const char *templatename, Eina_Tmpstr **path) { char buffer[PATH_MAX]; - char *tmpdirname, *sep; + const char *tmpdir = NULL; + char *tmpdirname; EINA_SAFETY_ON_NULL_RETURN_VAL(templatename, EINA_FALSE); - sep = strchr(templatename, '/'); -#ifdef _WIN32 - if (!sep) sep = strchr(templatename, '\\'); -#endif - if (sep) - { - eina_strlcpy(buffer, templatename, sizeof(buffer)); - } - else +# if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +# endif { - eina_file_path_join(buffer, sizeof(buffer), - eina_environment_tmp_get(), templatename); + tmpdir = getenv("TMPDIR"); + if (!tmpdir) tmpdir = getenv("XDG_RUNTIME_DIR"); } + if (!tmpdir) tmpdir = "/tmp"; + +#ifdef _WIN32 + if (strchr(templatename, '\\')) +#else + if (strchr(templatename, '/')) +#endif + snprintf(buffer, PATH_MAX, "%s", templatename); +else + snprintf(buffer, PATH_MAX, "%s/%s", tmpdir, templatename); tmpdirname = mkdtemp(buffer); if (tmpdirname == NULL) -- 2.7.4