nikawhite pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=94eaa792c279f3580c20ae0143f4637f982616cb

commit 94eaa792c279f3580c20ae0143f4637f982616cb
Author: Mykyta Biliavskyi <m.biliavs...@samsung.com>
Date:   Mon Feb 20 11:29:56 2017 +0200

    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 7205a45..1d329d2 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;

-- 


Reply via email to