[eglib] Ensures that home and user name always have a non-null value.
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 11 Jun 2015 20:25:55 +0000 (16:25 -0400)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 11 Jun 2015 20:25:55 +0000 (16:25 -0400)
eglib/src/gmisc-unix.c

index c7bd3f8e994c3beb2160b7a727e10aa3f84daa0a..273024871c5f890e01410f8a12094cf256cd33d8 100644 (file)
@@ -104,13 +104,15 @@ get_pw_data (void)
                                home_dir = g_strdup (pw.pw_dir);
                        if (user_name == NULL)
                                user_name = g_strdup (pw.pw_name);
-               } else {
-                       if (user_name == NULL)
-                               user_name = "somebody";
                }
        }
 #endif
 
+       if (user_name == NULL)
+               user_name = "somebody";
+       if (home_dir == NULL)
+               home_dir = "/";
+
        pthread_mutex_unlock (&pw_lock);
 }