summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorMykyta Biliavskyi <m.biliavskyi@samsung.com>2017-02-20 11:29:56 +0200
committerMykyta Biliavskyi <m.biliavskyi@samsung.com>2017-02-20 11:29:56 +0200
commit94eaa792c279f3580c20ae0143f4637f982616cb (patch)
tree111acf0773ed2bc5710312957604fd3283b8ac17 /src/lib/eina
parent80e3c643d8693a12b5650222c9181e71819fb8ef (diff)
eina utils: fix build without getpwent.
If HAVE_GETPWENT isn't defined - the closing brace was missed. Also prevent situation when strdup() tried to duplicate NULL pointer, because that could cause segfault. @fix
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/eina/eina_util.c b/src/lib/eina/eina_util.c
index 7205a45799..1d329d2d2a 100644
--- a/src/lib/eina/eina_util.c
+++ b/src/lib/eina/eina_util.c
@@ -84,12 +84,14 @@ eina_environment_home_get(void)
84 if (!getpwuid_r(geteuid(), &pwent, pwbuf, sizeof(pwbuf), &pwent2)) 84 if (!getpwuid_r(geteuid(), &pwent, pwbuf, sizeof(pwbuf), &pwent2))
85 { 85 {
86 if ((pwent2) && (pwent.pw_dir)) 86 if ((pwent2) && (pwent.pw_dir))
87 home = strdup(pwent.pw_dir); 87 {
88 home = strdup(pwent.pw_dir);
89 return home;
90 }
88 } 91 }
89 if (!home) home = strdup("/tmp");
90 return home;
91 }
92# endif 92# endif
93 home = "/tmp";
94 }
93#endif 95#endif
94 home = strdup(home); 96 home = strdup(home);
95 return home; 97 return home;