[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    patch post requested by Waldo
From:       AlanE <alane () geeksrus ! net>
Date:       2002-12-19 7:46:32
[Download RAW message or body]

The following patch has been confirmed to fix a kdesu-related bug in
arts. 

http://bugs.kde.org/show_bug.cgi?id=51381

This patch was against KDE 3.1-RC5.

==8<====8<====8<====8<====8<====8<====8<====8<====8<====8<==
--- mcop/mcoputils.cc.orig	Sat Feb  9 08:10:12 2002
+++ mcop/mcoputils.cc	Thu Dec 19 02:31:13 2002
@@ -31,6 +31,7 @@
 #include <errno.h>
 #include <config.h>
 #include <ctype.h>
+#include <pwd.h>	//included to get logname from uid
 #include <map>
 	
 using namespace std;
@@ -73,8 +74,18 @@
 
 string MCOPUtils::createFilePath(string name)
 {
+// changed to get logname from uid instead of environment variable
+// LOGNAME to avoid trouble when LOGNAME does not exist or
+// is wrong (such as in kdesu environment)
+// S. Voitzsch Sebastian.Voitzsch@web.de
+// 2002-12-03
+
+	struct passwd *pwd = NULL;
+	pwd = getpwuid(geteuid());
+	if (pwd == NULL) arts_fatal("could not get user name from user id");
+
 	string logname = "unknown";
-	if(getenv("LOGNAME")) logname = getenv("LOGNAME");
+	logname = pwd->pw_name;
 
 	string tmpdir = "/tmp/mcop-"+uglify(logname);
 	if(mkdir(tmpdir.c_str(),0700) != 0 && errno != EEXIST)
==8<====8<====8<====8<====8<====8<====8<====8<====8<====8<==

-- 
AlanE (Alan Eldridge), who likes fixing weird distributed systems bugs.
Unix/C(++) IT Pro for 20 yrs, desperately seeking employment in NYC.
(http://wwweasel.geeksrus.net/~alane/resume.rtf)
KDE, KDE-FreeBSD Teams (http://www.kde.org, http://freebsd.kde.org/)
_______________________________________________
kde-multimedia mailing list
kde-multimedia@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-multimedia
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic