From kde-core-devel Thu Dec 19 07:46:32 2002 From: AlanE Date: Thu, 19 Dec 2002 07:46:32 +0000 To: kde-core-devel Subject: patch post requested by Waldo X-MARC-Message: https://marc.info/?l=kde-core-devel&m=104028588424794 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 #include #include +#include //included to get logname from uid #include 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/)