summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'kde-base/arts/files/tmp-mcop-user-fix.patch')
-rw-r--r--kde-base/arts/files/tmp-mcop-user-fix.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/kde-base/arts/files/tmp-mcop-user-fix.patch b/kde-base/arts/files/tmp-mcop-user-fix.patch
new file mode 100644
index 000000000000..1a24fd51179d
--- /dev/null
+++ b/kde-base/arts/files/tmp-mcop-user-fix.patch
@@ -0,0 +1,33 @@
+--- ../foo/arts-1.0.4/mcop/mcoputils.cc 2002-02-09 14:10:12.000000000 +0100
++++ mcop/mcoputils.cc 2002-12-15 21:41:24.000000000 +0100
+@@ -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,20 @@
+
+ string MCOPUtils::createFilePath(string name)
+ {
+- string logname = "unknown";
+- if(getenv("LOGNAME")) logname = getenv("LOGNAME");
++// 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";
++ logname = pwd->pw_name;
++
++// if(getenv("LOGNAME")) logname = getenv("LOGNAME");
+
+ string tmpdir = "/tmp/mcop-"+uglify(logname);
+ if(mkdir(tmpdir.c_str(),0700) != 0 && errno != EEXIST)