Get user name from getpwuid, fixes #546
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 15 Feb 2009 19:17:29 +0000 (20:17 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 15 Feb 2009 19:17:29 +0000 (20:17 +0100)
src/common/identity.cpp

index 2652098..1978ebe 100644 (file)
@@ -88,7 +88,10 @@ QString Identity::defaultNick() {
     nick = shortUserName;
 
 #elif defined(Q_OS_UNIX)
     nick = shortUserName;
 
 #elif defined(Q_OS_UNIX)
-  QString userName = getlogin();
+  QString userName;
+  struct passwd *pwd = getpwuid(getuid());
+  if(pwd)
+    userName = pwd->pw_name;
   if(!userName.isEmpty())
     nick = userName;
 
   if(!userName.isEmpty())
     nick = userName;