]> git.lyx.org Git - lyx.git/blobdiff - src/support/userinfo.cpp
Fix bug #11084.
[lyx.git] / src / support / userinfo.cpp
index 5f2cfcab65599d954b565d8df803d0ab4c93a2ef..97c458c7c710882403686494f990a99112611960 100644 (file)
@@ -46,9 +46,11 @@ docstring const user_name()
        return from_local8bit(name);
 #else
        struct passwd * pw = getpwuid(geteuid());
-       LASSERT(pw, /**/);
+       LASSERT(pw, return docstring());
 
-       string name = pw->pw_gecos;
+       const string gecos = pw->pw_gecos;
+       const size_t pos = gecos.find(",");
+       string name = gecos.substr(0, pos);
        if (name.empty())
                name = pw->pw_name;
        return from_local8bit(name);
@@ -62,11 +64,12 @@ docstring const user_email()
        //The code after should be used only after user approval.
        return docstring();
 
-       
+#if 0
        string email = getEnv("EMAIL_ADDRESS");
        if (email.empty())
                email = getEnv("EMAIL");
        return from_local8bit(email);
+#endif
 }
 
 } // namespace support