summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-02-25 19:29:10 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-02-25 19:29:50 +0900
commitf44ccfe1d57f70ed9a58a47f805037883c11f924 (patch)
treee26695125994f1d6f5e983f3600abcba2430db53
parent87efca57ef942adbe66decd049bf31f17af29143 (diff)
eina - windows home get - donyt have static buffer and do it like unix
-rw-r--r--src/lib/eina/eina_util.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lib/eina/eina_util.c b/src/lib/eina/eina_util.c
index 1d329d2d2a..ae2cebe3f1 100644
--- a/src/lib/eina/eina_util.c
+++ b/src/lib/eina/eina_util.c
@@ -48,10 +48,6 @@
48 * API * 48 * API *
49 *============================================================================*/ 49 *============================================================================*/
50 50
51#ifdef _WIN32
52static char home_storage[8];
53#endif
54
55EAPI const char * 51EAPI const char *
56eina_environment_home_get(void) 52eina_environment_home_get(void)
57{ 53{
@@ -64,13 +60,14 @@ eina_environment_home_get(void)
64 if (!home && 60 if (!home &&
65 (getenv("HOMEDRIVE") && getenv("HOMEPATH"))) 61 (getenv("HOMEDRIVE") && getenv("HOMEPATH")))
66 { 62 {
67 memcpy(home_storage, getenv("HOMEDRIVE"), strlen(getenv("HOMEDRIVE"))); 63 char buf[PATH_MAX];
68 memcpy(home_storage + strlen(getenv("HOMEDRIVE")), 64
69 getenv("HOMEPATH"), strlen(getenv("HOMEPATH")) + 1); 65 snprintf(buf, sizeof(buf), "%s%s",
70 home = home_storage; 66 getenv("HOMEDRIVE"), getenv("HOMEPATH"));
67 home = strdup(buf);
68 return home;
71 } 69 }
72 if (!home) home = "C:\\"; 70 if (!home) home = "C:\\";
73
74#else 71#else
75# if defined(HAVE_GETUID) && defined(HAVE_GETEUID) 72# if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
76 if (getuid() == geteuid()) home = getenv("HOME"); 73 if (getuid() == geteuid()) home = getenv("HOME");