File utilize_xdg_runtime_dir.patch of Package kdelibs4

From: Andre Woebbeking <Woebbeking@kde.org>
Date: Fri, 10 Oct 2014 22:53:53 +0000
Subject: Sometimes when the system has high IO load (e. g. copying huge files or compiling and linking)
X-Git-Url: http://quickgit.kde.org/?p=kdelibs.git&a=commitdiff&h=c71ae727fdf3ff59a02519a66595b47e4371281e
---
Sometimes when the system has high IO load (e. g. copying huge files or compiling and linking)
some KDE apps become unresponsive. This seems to be caused by KDE's internal sockets created
in /tmp which is normally on the same block device as the ongoing IO traffic.

With this patch the sockets are created in the folder XDG_RUNTIME_DIR points to. On "current"
systems this folder is mounted with the tmpfs file system. So the sockets aren't affected by
high IO load anymore.

In frameworks QStandardPaths is used which does the same, so there is no need to port it.

REVIEW:120492
---


--- a/kinit/lnusertemp.c
+++ b/kinit/lnusertemp.c
@@ -256,6 +256,7 @@
 int main(int argc, char **argv)
 {
   const char *tmp = 0;
+  const char *xdg_runtime_dir = 0;
   char *tmp_prefix = 0;
   const char *kde_prefix = 0;
   int res = 0;
@@ -285,6 +286,10 @@
   }
   else if (strcmp(argv[1], "socket") == 0)
   {
+    xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
+    if (xdg_runtime_dir && xdg_runtime_dir[0])
+      tmp = xdg_runtime_dir;
+
     tmp_prefix = (char *)malloc(strlen(tmp)+strlen("/ksocket-")+1);
     strcpy(tmp_prefix, tmp );
     strcat(tmp_prefix, "/ksocket-" );

openSUSE Build Service is sponsored by