The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 4ce24954aae5e0af666741e69d5b93a7ad8e97ec
Author: Pavel Sanda <[email protected]>
Date:   Sun May 6 13:36:54 2012 +0200

    Strip gecos on Unix systems on user name only.
    Patch from Scott Kostyshak.

diff --git a/src/support/userinfo.cpp b/src/support/userinfo.cpp
index 5f2cfca..c873afe 100644
--- a/src/support/userinfo.cpp
+++ b/src/support/userinfo.cpp
@@ -48,7 +48,9 @@ docstring const user_name()
        struct passwd * pw = getpwuid(geteuid());
        LASSERT(pw, /**/);
 
-       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);
diff --git a/src/support/userinfo.h b/src/support/userinfo.h
index 2c482f4..6232a2b 100644
--- a/src/support/userinfo.h
+++ b/src/support/userinfo.h
@@ -18,7 +18,7 @@
 namespace lyx {
 namespace support {
 
-/// return the current user's real name
+/// return the current user's real name or user name
 docstring const user_name();
 
 /// return the current user's e-mail address

-----------------------------------------------------------------------

Summary of changes:
 src/support/userinfo.cpp |    4 +++-
 src/support/userinfo.h   |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to