From 94eaa792c279f3580c20ae0143f4637f982616cb Mon Sep 17 00:00:00 2001 From: Mykyta Biliavskyi Date: Mon, 20 Feb 2017 11:29:56 +0200 Subject: [PATCH] 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 --- src/lib/eina/eina_util.c | 10 ++++++---- 1 file 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) if (!getpwuid_r(geteuid(), &pwent, pwbuf, sizeof(pwbuf), &pwent2)) { if ((pwent2) && (pwent.pw_dir)) - home = strdup(pwent.pw_dir); + { + home = strdup(pwent.pw_dir); + return home; + } } - if (!home) home = strdup("/tmp"); - return home; - } # endif + home = "/tmp"; + } #endif home = strdup(home); return home;